util

package
v1.0.26 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Base64Decode

func Base64Decode(encoded string) (string, error)

Base64Decode decodes 64 encoded string

func Base64Encode

func Base64Encode(text string) string

Base64Encode encodes a string

func ConvertToJSON

func ConvertToJSON(item interface{}) (string, error)

ConvertToJSON convert object to json

func GetVal

func GetVal(hash map[string]string, key, def string) string

GetVal gets a value from a hash map

func InArray

func InArray(val interface{}, array interface{}) bool

InArray check if value is on array

func IsEmpty

func IsEmpty(item string) bool

IsEmpty validate if string is empty or not

func LoadFromJSON

func LoadFromJSON(item interface{}, data []byte) error

LoadFromJSON update object from json

func MergeMaps

func MergeMaps(m1, m2 map[string]string) map[string]string

MergeMaps merges two maps

func Rand

func Rand(min, max int) int

Rand gets a random number

func Unset

func Unset(a []string, i int) []string

Unset remove element at position i

Types

type Map

type Map struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Map type

func NewMap

func NewMap() Map

NewMap creates a new instance of Map

func (*Map) Delete

func (cm *Map) Delete(key string)

Delete deletes a key

func (*Map) Get

func (cm *Map) Get(key string) (interface{}, bool)

Get a key from a concurrent map

func (*Map) Set

func (cm *Map) Set(key string, value interface{})

Set a key in a concurrent map

Jump to

Keyboard shortcuts

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