github.com/yaoapp/kun@v0.9.0/interfaces/map.go (about)

     1  package interfaces
     2  
     3  // Map the map interface (map[string]inteface{})
     4  type Map = MapStrAny
     5  
     6  // MapStr the map interface (map[string]inteface{})
     7  type MapStr = MapStrAny
     8  
     9  // MapStrAny the map interface (map[string]inteface{})
    10  type MapStrAny interface {
    11  	Set(key string, value interface{})
    12  	Get(key string) interface{}
    13  	Del(key string)
    14  	GetOrSet(key string, value interface{}) interface{}
    15  	GetAndDel(key string) interface{}
    16  	Range(func(key string, value interface{}) bool)
    17  	Has(key string) bool
    18  	Len() int
    19  	Keys() []string
    20  	Values() []interface{}
    21  	IsEmpty() bool
    22  	Merge(maps ...MapStr)
    23  }
    24  
    25  // MapAny the map interface (map[inteface{}]inteface{})
    26  type MapAny = MapAnyAny
    27  
    28  // MapAnyAny the map interface (map[inteface{}]inteface{})
    29  type MapAnyAny interface {
    30  	Set(key, value interface{})
    31  	Get(key interface{}) interface{}
    32  	Del(key interface{})
    33  	GetOrSet(key, value interface{}) interface{}
    34  	GetAndDel(key interface{}) interface{}
    35  	Range(func(key, value interface{}) bool)
    36  	IsEmpty() bool
    37  	Merge(maps ...MapStrStr)
    38  }
    39  
    40  // MapStrStr the map interface (map[string]string)
    41  type MapStrStr interface {
    42  	Set(key string, value string)
    43  	Get(key string) string
    44  	Del(key string)
    45  	GetOrSet(key string, value string) string
    46  	GetAndDel(key string) string
    47  	Range(func(key string, value string) bool)
    48  	IsEmpty() bool
    49  	Merge(maps ...MapStrStr)
    50  }