github.com/shuguocloud/go-zero@v1.3.0/core/mapping/valuer.go (about)

     1  package mapping
     2  
     3  type (
     4  	// A Valuer interface defines the way to get values from the underlying object with keys.
     5  	Valuer interface {
     6  		// Value gets the value associated with the given key.
     7  		Value(key string) (interface{}, bool)
     8  	}
     9  
    10  	// A MapValuer is a map that can use Value method to get values with given keys.
    11  	MapValuer map[string]interface{}
    12  )
    13  
    14  // Value gets the value associated with the given key from mv.
    15  func (mv MapValuer) Value(key string) (interface{}, bool) {
    16  	v, ok := mv[key]
    17  	return v, ok
    18  }