util

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2019 License: GPL-3.0 Imports: 8 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	JSONMarshal       = json.Marshal
	JSONUnmarshal     = json.Unmarshal
	JSONMarshalIndent = json.MarshalIndent
	JSONNewDecoder    = json.NewDecoder
	JSONNewEncoder    = json.NewEncoder
)

Define JSON operations

Functions

func JSONMarshalToString

func JSONMarshalToString(v interface{}) string

JSONMarshalToString - JSON encoded as a string

func MD5Hash

func MD5Hash(b []byte) string

MD5Hash - MD5 hash value

func MD5HashString

func MD5HashString(s string) string

MD5HashString - MD5 hash value

func MustUUID

func MustUUID() string

MustUUID - Create a UUID and throw a panic if an error occurs

func NewTraceID

func NewTraceID() string

NewTraceID - Create tracking ID

func NewUUID

func NewUUID() (string, error)

NewUUID - Create a UUID

func SHA1Hash

func SHA1Hash(b []byte) string

SHA1Hash - SHA1 hash value

func SHA1HashString

func SHA1HashString(s string) string

SHA1HashString - SHA1 hash value

Types

type S

type S string

S - String type conversion

func (S) Bool

func (s S) Bool() (bool, error)

Bool - Convert to bool

func (S) Bytes

func (s S) Bytes() []byte

Bytes - Convert to []byte

func (S) DefaultBool

func (s S) DefaultBool(defaultVal bool) bool

DefaultBool - Convert to bool, use default if an error occurs

func (S) DefaultFloat32

func (s S) DefaultFloat32(defaultVal float32) float32

DefaultFloat32 - Convert to float32, use default if an error occurs

func (S) DefaultFloat64

func (s S) DefaultFloat64(defaultVal float64) float64

DefaultFloat64 - Convert to float64, use default if an error occurs

func (S) DefaultInt

func (s S) DefaultInt(defaultVal int) int

DefaultInt - Convert to int, use default if an error occurs

func (S) DefaultInt64

func (s S) DefaultInt64(defaultVal int64) int64

DefaultInt64 - Convert to int64, use default if an error occurs

func (S) DefaultUint

func (s S) DefaultUint(defaultVal uint) uint

DefaultUint - Convert to uint, use default if an error occurs

func (S) DefaultUint64

func (s S) DefaultUint64(defaultVal uint64) uint64

DefaultUint64 - Convert to uint64, use default if an error occurs

func (S) Float32

func (s S) Float32() (float32, error)

Float32 - Convert to float32

func (S) Float64

func (s S) Float64() (float64, error)

Float64 - Convert to float64

func (S) Int

func (s S) Int() (int, error)

Int - Convert to int

func (S) Int64

func (s S) Int64() (int64, error)

Int64 - Convert to int64

func (S) String

func (s S) String() string

func (S) ToJSON

func (s S) ToJSON(v interface{}) error

ToJSON - Convert to JSON

func (S) Uint

func (s S) Uint() (uint, error)

Uint - Convert to uint

func (S) Uint64

func (s S) Uint64() (uint64, error)

Uint64 - Convert to uint64

Jump to

Keyboard shortcuts

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