utils

package
v0.0.0-...-f34ac1a Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2018 License: LGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Deserialize

func Deserialize(jsonStr string) interface{}

func FileExists

func FileExists(name string) bool

FileExists reports whether the named file or directory exists.

func GenDate

func GenDate() string

func GenSpecialTimestamp

func GenSpecialTimestamp(fullTimeStr string) (string, error)

func GenSpecialTimestampAfterSeconds

func GenSpecialTimestampAfterSeconds(timestamp string, seconds int64) (string, error)

func GenSpecialTimestampAfterSecondsWithFullTimeStr

func GenSpecialTimestampAfterSecondsWithFullTimeStr(fullTimeStr string, seconds int64) (string, error)

func GenTimestamp

func GenTimestamp() string

func GetCurrentDirectory

func GetCurrentDirectory() string

func GetParentDirectory

func GetParentDirectory(dirctory string) string

func MapToStruct

func MapToStruct(mapObj map[string]interface{}) (interface{}, error)

func RandInt

func RandInt(min int, max int) int

func Serialize

func Serialize(obj interface{}, escapeHTML ...bool) string

------------- Structs keys are marshalled in the order defined in the struct ------------------

func SerializePretty

func SerializePretty(obj interface{}, escapeHTML ...bool) string

only for selfTest, format json output

func StructSerialize

func StructSerialize(obj interface{}, escapeHTML ...bool) string

The json package always orders keys when marshalling. Specifically:

Maps have their keys sorted lexicographically. Structs keys are marshalled in the order defined in the struct

------------------------------ struct serialize must use this ----------------------------- ------------------------------ Hash and Sign use this -----------------------------

func StructSerializePretty

func StructSerializePretty(obj interface{}, escapeHTML ...bool) string

only for selfTest, format json output

func StructToMap

func StructToMap(obj interface{}) (map[string]interface{}, error)

func Try

func Try(execFunc func(), afterPanic func(interface{}))

* try...catch * \param [in] * \return

func TypeToString

func TypeToString(name interface{}) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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