Documentation ¶
Index ¶
- func GetType(req interface{}) reflect.Type
- func ModelName(model interface{}) string
- func ObjOfPtrType(req interface{}) (res interface{})
- func ObjOfType(req interface{}) (res interface{})
- func ObjsOfTheSameType(first interface{}, second interface{}) bool
- func PtrSliceOfPtrType(req interface{}) (res interface{})
- func SliceOfPtrType(req interface{}) (res interface{})
- func SliceOfType(req interface{}) (res interface{})
- func StructName(model interface{}) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetType ¶
GetType returns the type of the 'req' source object. I.e. for *Foo, []Foo, []*Foo object the function returns the Type Foo
func ModelName ¶
func ModelName(model interface{}) string
ModelName returns lowercase model name. If provided model is of slice type then model name would be pluralized. i.e.
- Model would return 'model'
- []Model would return 'models'
func ObjOfPtrType ¶
func ObjOfPtrType(req interface{}) (res interface{})
ObjOfPtrType returns the object of pointer type given in request For example if req is type Foo it returns new object of type *Foo The function deeply checks type of the request so that even if it is type *****Foo the result would be of type Foo
func ObjOfType ¶
func ObjOfType(req interface{}) (res interface{})
ObjOfType returns the empty object of type given in request For example if req is type Foo it returns empty object of type Foo The function deeply checks type of the request so that even if it is type *****Foo the result would be of type Foo
func ObjsOfTheSameType ¶
func ObjsOfTheSameType(first interface{}, second interface{}) bool
func PtrSliceOfPtrType ¶
func PtrSliceOfPtrType(req interface{}) (res interface{})
PtrSliceOfPtrType returns a pointer to an empty slice of pointers of a type provided in request In example providing type Foo in request, the funciton returns *[]*Foo
func SliceOfPtrType ¶
func SliceOfPtrType(req interface{}) (res interface{})
SliceOfPtrType returns empty slice of a pointers of a type provided in request In example providing type Foo in request, the function returns res of type []*Foo
func SliceOfType ¶
func SliceOfType(req interface{}) (res interface{})
SliceOfType returns empty slice of a type provided in request In example providing type Foo in request, the function returns res of type []Foo
func StructName ¶
func StructName(model interface{}) string
StructName returns the name of the provided model
Types ¶
This section is empty.