helper

package
v0.0.0-...-60051b8 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Amount2Decimal

func Amount2Decimal(s float64) float64

Amount2Decimal return amount only 2 decima places.

func DateStrToUnixNano

func DateStrToUnixNano(value string, layout ...string) int64

DateStrToUnixNano convert date string formated to epoch unix nano seconds.

func DateStrToUnixNanoStrict

func DateStrToUnixNanoStrict(value string, layout ...string) (int64, error)

DateStrToUnixNanoStrict same like DateStrToUnixNano, but will return error if got any error.

func DeleteCache

func DeleteCache(
	instance *cache.Cache,
	ck string,
) error

Cache delete

func GetCache

func GetCache(instance *cache.Cache, ck string, wanted interface{}) error

func InArray

func InArray(v interface{}, in interface{}) (ok bool)

func MapToProtobufStruct

func MapToProtobufStruct(m map[string]interface{}) (*structpb.Struct, error)

convert map[string]interface{} to *structpb.Struct

func NewPBStruct

func NewPBStruct(v map[string]interface{}) (map[string]*structpb.Value, error)

NewPBStruct constructs a Struct from a general-purpose Go map. The map keys must be valid UTF-8. The map values are converted using NewValue.

func PBStructToMap

func PBStructToMap(s *structpb.Struct) (*string, error)

convert *structpb.Struct to map[string]interface{}

func SetCache

func SetCache(instance *cache.Cache, ck string, val interface{}, ttl ...time.Duration) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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