Documentation
¶
Overview ¶
Package inspector is a package of utility functions for inspecting field names and keys from objects.
Index ¶
- func GetFieldNames(object interface{}, sorted bool, reversed bool) []string
- func GetFieldNamesFromValue(value reflect.Value, sorted bool, reversed bool) []string
- func GetKeys(object interface{}, sorted bool, reversed bool) []interface{}
- func GetKeysFromValue(m reflect.Value, sorted bool, reversed bool) []interface{}
- func GetUnknownFieldNamesFromValue(value reflect.Value, knownKeys map[string]struct{}, sorted bool, reversed bool) []string
- func GetUnknownKeys(object interface{}, knownKeys map[interface{}]struct{}, sorted bool, ...) []interface{}
- func GetUnknownKeysFromValue(m reflect.Value, knownKeys map[interface{}]struct{}, sorted bool, ...) []interface{}
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetFieldNames ¶
GetFieldNames returns the field names of a struct as []string. If you want the field names to be sorted in alphabetical order, pass sorted equal to true. If sorted and reversed, then sorts in reverse alphabetical order.
func GetFieldNamesFromValue ¶
GetFieldNamesFromValue returns the field names of a struct as []string. If you want the field names to be sorted in alphabetical order, pass sorted equal to true. If sorted and reversed, then sorts in reverse alphabetical order.
func GetKeys ¶
GetKeys returns the keys for a map as an []interface{}. If you want the keys to be sorted in alphabetical order, pass sorted equal to true. If sorted and reversed, then sorts in reverse alphabetical order.
func GetKeysFromValue ¶
GetKeysFromValue returns the keys for a map as an []interface{}. If you want the keys to be sorted in alphabetical order, pass sorted equal to true. If sorted and reversed, then sorts in reverse alphabetical order.
func GetUnknownFieldNamesFromValue ¶ added in v0.0.9
func GetUnknownFieldNamesFromValue(value reflect.Value, knownKeys map[string]struct{}, sorted bool, reversed bool) []string
GetUnknownFieldNamesFromValue returns the unknown field names for a struct as a []string{} given a set of known field names. If you want the field names to be sorted in alphabetical order, pass sorted equal to true. If sorted and reversed, then sorts in reverse alphabetical order.
func GetUnknownKeys ¶
func GetUnknownKeys(object interface{}, knownKeys map[interface{}]struct{}, sorted bool, reversed bool) []interface{}
GetUnknownKeys returns the unknown keys for a map as an []interface{} given a set of known keys. If you want the keys to be sorted in alphabetical order, pass sorted equal to true. If sorted and reversed, then sorts in reverse alphabetical order.
func GetUnknownKeysFromValue ¶
func GetUnknownKeysFromValue(m reflect.Value, knownKeys map[interface{}]struct{}, sorted bool, reversed bool) []interface{}
GetUnknownKeysFromValue returns the unknown keys for a map as an []interface{} given a set of known keys. If you want the keys to be sorted in alphabetical order, pass sorted equal to true. If sorted and reversed, then sorts in reverse alphabetical order.
Types ¶
This section is empty.