helpers

package
v1.0.52 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildJSON

func BuildJSON(json interface{}, includeRoot bool, root string) interface{}

BuildJSON used to build json with parameters like root key

func GetFieldValueByName

func GetFieldValueByName(s interface{}, name string) interface{}

func IncludeRootInJSON

func IncludeRootInJSON(json interface{}, includeRoot bool, root string) interface{}

IncludeRootInJSON used prepend root in JSON

func MapValues added in v1.0.28

func MapValues(ss interface{}, field string) []interface{}

func NotFoundError

func NotFoundError(itemName string) error

NotFoundError used to generate error for not round record

func Rand added in v1.0.46

func Rand() float32

Rand used to generate a random float from 0.0 - 1.0

func RandRange added in v1.0.31

func RandRange(min int, max int) int

RandRange used to generate a random number from min to max inclusively

func Range

func Range(min int, max int) []int

Range used to create slice

func SetFieldValueByNameStr added in v1.0.12

func SetFieldValueByNameStr(s interface{}, name string, value string)

func Times

func Times(n int, handler func(int) bool)

Times used to iterate n times with handler

Types

type Dictionary

type Dictionary struct {
	// contains filtered or unexported fields
}

Dictionary used to provide accessibilities to dynamic hash

func GetFieldsDetailsByTag added in v1.0.12

func GetFieldsDetailsByTag(s interface{}, tag string) []*Dictionary

func MakeDictionary

func MakeDictionary(properties H) *Dictionary

MakeDictionary used to instantiate dictionary instance

func (*Dictionary) Set

func (dict *Dictionary) Set(key string, value interface{})

Set used to set property

func (*Dictionary) Value

func (dict *Dictionary) Value(key string) interface{}

Value used to retrieve params value

func (*Dictionary) ValueBool

func (dict *Dictionary) ValueBool(key string) bool

ValueBool used to retrieve params value in boolean

func (*Dictionary) ValueDicts added in v1.0.32

func (dict *Dictionary) ValueDicts(key string) []*Dictionary

func (*Dictionary) ValueFloat64

func (dict *Dictionary) ValueFloat64(key string, fallback float64) float64

ValueFloat64 used to retrieve params value in float64

func (*Dictionary) ValueInt

func (dict *Dictionary) ValueInt(key string, fallback int) int

ValueInt used to retrieve params value in int

func (*Dictionary) ValueList

func (dict *Dictionary) ValueList(key string) []interface{}

func (*Dictionary) ValueStr

func (dict *Dictionary) ValueStr(key string) string

ValueStr used to retrieve params value in string

type Enumerable

type Enumerable interface{}

type H

type H map[string]interface{}

H is alias for map[string]interface{}

func Merge

func Merge(h1 H, h2 H) H

Merge used to merge to map

Jump to

Keyboard shortcuts

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