Documentation ¶
Overview ¶
Package mr implements cached functionality for efficient introspection of models and other related structs. It is used to implement the generic reflect-based indexes and selective JSON streaming in the front end.
Index ¶
- func Equal(a, b interface{}) bool
- func Fetch(v interface{}, fields ...string) (res interface{}, found bool)
- func IsText(t reflect.Type) bool
- func K(t reflect.Type) reflect.Kind
- func ReallyAMap(v interface{}, x func(interface{}) interface{})
- func T(t reflect.Type) reflect.Type
- func TK(t reflect.Type) (reflect.Type, reflect.Kind)
- func V(v reflect.Value) reflect.Value
- type F
- type Field
- type Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsText ¶
IsText indicates that this field will be marshalled and unmarshalled into a string. Fields uses it to skip processing for certain fields.
func ReallyAMap ¶
func ReallyAMap(v interface{}, x func(interface{}) interface{})
ReallyAMap is used to signal to this package that the passed-in type for v is really just a Map under the hood, and x should be used to resolve down to the map in question. It should be called during init() before Fields is called for the first time.
Types ¶
type F ¶
type F struct { // Docs is the docs for this struct/map Docs string // TopLevel returns all the keys that can be accessed directly on a struct, // and everything in a specific map. It includes embedded structs. TopLevel []string // All returns all the fields that can be accessed via s struct or map. Indirections to // other structs are indicated by having a / in the value. All []string // contains filtered or unexported fields }
F keeps track of everything needed to look up values in an arbitrary struct or map.
type Field ¶
type Field struct { Value Index struct { Name string Key bool Unique bool Ignore bool Shard bool NoEq bool } Json struct { Name string Ignore bool OmitEmpty bool } Options options reflect.StructField }
Field is a reflect.StructField, some useful pre-parsed tag information, and a function that can fetch something from the location of the Field.