utils

package
v0.0.0-...-bfcc399 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MAP_TAG_NAME = "map"
)
View Source
const Size = 16

Variables

This section is empty.

Functions

func GetTodayYMD

func GetTodayYMD(sep string) string

获取当天 年-月-日 格式

func IsExist

func IsExist(path string) bool

func JSON2Struct

func JSON2Struct(m map[interface{}]interface{}, target interface{}) error

json映射 -> struct

func NewRand

func NewRand(size int) int

func OpenFileSafety

func OpenFileSafety(pathname string, flag int, perm os.FileMode) (f *os.File, err error)

func ParseEnvForTag

func ParseEnvForTag(a interface{}, tagName string) (err error)

根据struts解析环境变量

func Str2IntForMonth

func Str2IntForMonth(month string) int

字符串名称月份 -> 整数月份

func String2Int

func String2Int(s string) int

func Struct2Json

func Struct2Json(strut interface{}) (map[string]interface{}, error)

strut -> json

func Struct2Map

func Struct2Map(a interface{}) map[string]interface{}

struct -> map

func Struct2MapFromTag

func Struct2MapFromTag(a interface{}) map[string]interface{}

根据tag struct -> map

func StructCopy

func StructCopy(from interface{}, to interface{}) error

Struct kv copy from -> to

Types

type UUID

type UUID [Size]byte

func NewUUID

func NewUUID() (*UUID, error)

生成uuid

func (UUID) String

func (u UUID) String() string

Jump to

Keyboard shortcuts

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