Documentation
¶
Index ¶
- func Deref(t reflect.Type) reflect.Type
- func DerefDeep(t reflect.Type) reflect.Type
- func ElementTypeFromSlice(sliceIn interface{}) (reflect.Type, error)
- func GetFieldsByTag(in interface{}, tag string) map[string]interface{}
- func GetFieldsByTagWithTagValues(in interface{}, tag string, iterators ...fieldTagIterator) map[string]TagValueInterface
- func GetInterfaceName(in interface{}) string
- func GetInterfaceSlice(in interface{}) interface{}
- func GetTagValues(in interface{}, tag string, formatters ...(func(string) string)) []string
- func GuessTableName(in interface{}) (string, error)
- func InitSetField(fieldVal, newVal reflect.Value) error
- func InterfaceToSQLValue(in interface{}) string
- func IsZeroValue(in interface{}) bool
- func LowerSnakeToUpperCamel(lowerSnake string) string
- func UpperCamelToSnake(raw string) string
- type BSTag
- type FieldWithBS
- type GroupFieldWithBSBy
- type GroupedFieldsWithBS
- type TagValueInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Deref ¶
Deref is Indirect for reflect.Types Pulled from sqlx/reflectx: https://tinyurl.com/y9akfp5n
func ElementTypeFromSlice ¶
ElementTypeFromSlice takes a slice or a pointer to slice and returns the type of its element(s).
func GetFieldsByTag ¶
GetFieldsByTag will get all fields in an object for a given tag.
func GetFieldsByTagWithTagValues ¶
func GetFieldsByTagWithTagValues( in interface{}, tag string, iterators ...fieldTagIterator, ) map[string]TagValueInterface
GetFieldsByTagWithTagValues will get all fields in an object for a given tag and also the values associated with the specified tag. TODO: This should probably return an iterator or something so that the
resulting code doesn't repeat the iteration.
func GetInterfaceName ¶
func GetInterfaceName(in interface{}) string
GetInterfaceName will get the resolved name of an interface.
func GetInterfaceSlice ¶
func GetInterfaceSlice(in interface{}) interface{}
GetInterfaceSlice for some arbitrary interface get an interface that represents a slice of its type.
func GetTagValues ¶
GetTagValues will get all the fields tag values as a slice.
func GuessTableName ¶
func InitSetField ¶
func InterfaceToSQLValue ¶
func InterfaceToSQLValue( in interface{}, ) string
InterfaceToSQLValue will take an interface, and try to cleverly convert it to the best SQL value representation.
func IsZeroValue ¶
func IsZeroValue(in interface{}) bool
func LowerSnakeToUpperCamel ¶
func UpperCamelToSnake ¶
Types ¶
type BSTag ¶
type BSTag struct {
// contains filtered or unexported fields
}
func (BSTag) AllProperties ¶
func (BSTag) HasProperty ¶
type FieldWithBS ¶
type FieldWithBS struct {
// contains filtered or unexported fields
}
func (FieldWithBS) Interface ¶
func (self FieldWithBS) Interface() interface{}
func (FieldWithBS) Name ¶
func (self FieldWithBS) Name() string
func (FieldWithBS) Tag ¶
func (self FieldWithBS) Tag(key string) *BSTag
func (FieldWithBS) Tags ¶
func (self FieldWithBS) Tags() []*BSTag
type GroupFieldWithBSBy ¶
type GroupFieldWithBSBy func(*GroupedFieldsWithBS, *FieldWithBS)
GroupFieldWithBSBy takes in a new FieldWithBS and the existing GroupedFieldsWithBS and inserts the FieldWithBs appropriately according to its grouping function.
func GroupFieldsByFieldName ¶
func GroupFieldsByFieldName() GroupFieldWithBSBy
GroupFieldsByFieldName is a grouping function that will group all the input FieldWithBS by its field name.
func GroupFieldsByTagName ¶
func GroupFieldsByTagName() GroupFieldWithBSBy
GroupFieldsByTagName is a grouping function that will group all the input FieldWithBS by its tag name.
func GroupFieldsByTagValue ¶
func GroupFieldsByTagValue( tagNames ...string, ) GroupFieldWithBSBy
GroupFieldsByTagValue is a grouping function that will group all the input FieldWithBS by its tag value.
type GroupedFieldsWithBS ¶
type GroupedFieldsWithBS map[string]*FieldWithBS
GroupedFieldsWithBS is a map of some grouping string to a FieldWithBS.
func GetGroupedFieldsWithBS ¶
func GetGroupedFieldsWithBS( in interface{}, byFilters ...GroupFieldWithBSBy, ) []*GroupedFieldsWithBS
GetGroupedFieldsWithBS takes an interface and returns a series of maps that group FieldWithBS by the provided grouping functions in provided order.
type TagValueInterface ¶
type TagValueInterface struct { TagValue string Interface interface{} }
TagValueInterface is a type which holds both a TagValue and an interface.
func (*TagValueInterface) IsUnset ¶
func (tvi *TagValueInterface) IsUnset() bool
IsUnset checks if the value of the TagValueInterface is unset.