You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
go-zero/core/mapping/valuer.go

19 lines
512 B
Go

4 years ago
package mapping
type (
// A Valuer interface defines the way to get values from the underlying object with keys.
4 years ago
Valuer interface {
// Value gets the value associated with the given key.
4 years ago
Value(key string) (interface{}, bool)
}
// A MapValuer is a map that can use Value method to get values with given keys.
4 years ago
MapValuer map[string]interface{}
)
// Value gets the value associated with the given key from mv.
4 years ago
func (mv MapValuer) Value(key string) (interface{}, bool) {
v, ok := mv[key]
return v, ok
}