helpers

package
v0.0.0-...-b9a69e3 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DotPathToSlashPath

func DotPathToSlashPath(p string) string

DotPathToSlashPath converts a dot path to a dir path

func GetElement

func GetElement(value interface{}) reflect.Value

GetElement gets the value

func GetKind

func GetKind(value interface{}) reflect.Kind

GetKind strips the pointer and interface from the kind

func GetType

func GetType(value interface{}) reflect.Type

GetType gets the type using reflect

func GetTypeName

func GetTypeName(myvar interface{}) string

GetTypeName gets the type name

func IsArrayLike

func IsArrayLike(value interface{}) bool

IsArrayLike checks if array like

func IsObjectID

func IsObjectID(obj interface{}) bool

IsObjectID tests if obj is an object id

func IsString

func IsString(value interface{}) bool

IsString check if the interface is a string

func ToInterface

func ToInterface(src interface{}, dest interface{}) error

ToInterface converts one interface to another using json

func ToSnakeCase

func ToSnakeCase(str string) string

ToSnakeCase converts to snake case https://gist.github.com/stoewer/fbe273b711e6a06315d19552dd4d33e6

func ValidatorAlphaNumeric

func ValidatorAlphaNumeric(value interface{}, fieldName string, doc bson.M) error

ValidatorAlphaNumeric performs an alpha-numeric validation on a value

func VirtualGetObjectIDAsHexString

func VirtualGetObjectIDAsHexString(fieldName string) func(doc bson.M) (interface{}, error)

VirtualGetObjectIDAsHexString returns the specified field containing an ObjectID as a hex string

func VirtualGetWithDefault

func VirtualGetWithDefault(fieldName string, defaultValue interface{}) func(doc bson.M) (interface{}, error)

VirtualGetWithDefault gets the specified field or returns default if set

func VirtualSetNoop

func VirtualSetNoop(value interface{}, doc bson.M) error

VirtualSetNoop does nothing, you're welcome

func VirtualSetObjectID

func VirtualSetObjectID(fieldName string) func(value interface{}, doc bson.M) error

VirtualSetObjectID sets an object id

Types

This section is empty.

Jump to

Keyboard shortcuts

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