refutils

package
v0.0.0-...-3215105 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 4, 2018 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetType

func GetType(req interface{}) reflect.Type

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL