utils

package
v0.0.1-beta Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetValueAndType

func GetValueAndType(v interface{}) (reflect.Value, reflect.Type)

Get the underlying value of v even if it is a pointer. Returns nil and type of kind reflect.Ptr if it is nil pointer

func Normalize

func Normalize(v interface{}) (interface{}, error)

Converts all value types into their standard type

i.e int64 to int, or structs to maps

func ProcessTag

func ProcessTag(tag string) (string, bool)

Process the struct tag and return both the first value (key to use in document) and either to omitempty the field associated with the tag

func RandomString

func RandomString(length int) string

Generate a random string

func Round

func Round(num float64, precision int) float64

Rounds a floating point number to a precision/number of decimal places

func ToBytes

func ToBytes(s string) []byte

Converts a string into array of bytes

Types

This section is empty.

Jump to

Keyboard shortcuts

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