flamingo.me/flamingo-commerce/v3@v3.11.0/cart/interfaces/graphql/dto/additional_data.go (about)

     1  package dto
     2  
     3  type (
     4  
     5  	// CustomAttributes represents map of custom attributes of cart and delivery info
     6  	CustomAttributes struct {
     7  		Attributes map[string]string
     8  	}
     9  
    10  	// KeyValue for cart and delivery
    11  	KeyValue struct {
    12  		Key   string
    13  		Value string
    14  	}
    15  
    16  	// DeliveryAdditionalData of delivery
    17  	DeliveryAdditionalData struct {
    18  		DeliveryCode   string
    19  		AdditionalData []KeyValue
    20  	}
    21  )
    22  
    23  // Get attribute by key
    24  func (c *CustomAttributes) Get(key string) *KeyValue {
    25  	if c.Attributes == nil {
    26  		return nil
    27  	}
    28  
    29  	if value, found := c.Attributes[key]; found {
    30  		return &KeyValue{Key: key, Value: value}
    31  	}
    32  
    33  	return nil
    34  }