utils

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: MulanPSL-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MbTable = []uint16{}/* 256 elements not displayed */

Functions

func Bool2Str

func Bool2Str(b bool) string

func BoolPtr2Str

func BoolPtr2Str(b *bool) string

func Camel2Case

func Camel2Case(name string) string

func Capitalize

func Capitalize(str string) string

func Case2Camel

func Case2Camel(name string) string

下划线写法转为驼峰写法

func CheckCrc

func CheckCrc(cmd []byte, data []byte, pos int, dlen int) bool

Modbus协议Crc校验

func CheckQueryParamUsing

func CheckQueryParamUsing(param *interface{}) (ok bool)

func GetTime

func GetTime() int64

获取时间

func Int64ToLocalDateInt

func Int64ToLocalDateInt(sec int64) basemodel.LocalDateInt

func Int64ToLocalDateIntPtr

func Int64ToLocalDateIntPtr(sec int64) *basemodel.LocalDateInt

func Int64ToLocalTimeInt

func Int64ToLocalTimeInt(sec int64) basemodel.LocalTimeInt

func Int64ToLocalTimeIntPtr

func Int64ToLocalTimeIntPtr(sec int64) *basemodel.LocalTimeInt

func Int64ToLocalTimeIntUtcPtr

func Int64ToLocalTimeIntUtcPtr(sec int64) *basemodel.LocalTimeUTCInt

func Int64ToLocalTimeUtcInt

func Int64ToLocalTimeUtcInt(sec int64) basemodel.LocalTimeUTCInt

func Inttime2Str

func Inttime2Str(timestamp int64) string

func Ip4

func Ip4() string

LocalTimeInt

func Lcfirst

func Lcfirst(str string) string

首字母小写

func List2string

func List2string(lst *list.List) string

func List2stringBy

func List2stringBy(lst *list.List, sep string) string

func LogList

func LogList(lst *list.List)

func ModbusCrcCheckSum

func ModbusCrcCheckSum(data []byte) []byte

func ParseTemplateString

func ParseTemplateString(str string, vars interface{}) string

func PrintList

func PrintList(lst *list.List)

func RandomString

func RandomString(n int) string

func Round

func Round(f float64, n int) float64

func SetFieldValue

func SetFieldValue(ind reflect.Value, value interface{})

func Str2BoolPtr

func Str2BoolPtr(s string) *bool

func Str2Int64

func Str2Int64(in string) int64

timeNow := tNow.Format("2006-01-02 15:04:05")

func Strtime2Int

func Strtime2Int(datetime string) (timestamp int64)

func Strtime2Time

func Strtime2Time(datetime string) time.Time

func ToInt32

func ToInt32(value interface{}) (d int32)

func ToInt64

func ToInt64(value interface{}) (d int64)

ToInt64 interface to int64

func ToStr

func ToStr(value interface{}, args ...int) (s string)

ToStr interface to string

func Ucfirst

func Ucfirst(str string) string

首字母大写

func UcfirstCase2Camel

func UcfirstCase2Camel(str string) string

func UniqueId

func UniqueId() string

func UnzipStr

func UnzipStr(zipContent string) (originInfo []byte)

func ZipStr

func ZipStr(origin string) (content string)

Types

type Buffer

type Buffer struct {
	*bytes.Buffer
}

内嵌bytes.Buffer,支持连写

func NewBuffer

func NewBuffer() *Buffer

func (*Buffer) Append

func (b *Buffer) Append(i interface{}) *Buffer

type StrTo

type StrTo string

StrTo is the target string

func (StrTo) Bool

func (f StrTo) Bool() (bool, error)

Bool string to bool

func (*StrTo) Clear

func (f *StrTo) Clear()

Clear string

func (StrTo) Exist

func (f StrTo) Exist() bool

Exist check string exist

func (StrTo) Float32

func (f StrTo) Float32() (float32, error)

Float32 string to float32

func (StrTo) Float64

func (f StrTo) Float64() (float64, error)

Float64 string to float64

func (StrTo) Int

func (f StrTo) Int() (int, error)

Int string to int

func (StrTo) Int16

func (f StrTo) Int16() (int16, error)

Int16 string to int16

func (StrTo) Int32

func (f StrTo) Int32() (int32, error)

Int32 string to int32

func (StrTo) Int64

func (f StrTo) Int64() (int64, error)

Int64 string to int64

func (StrTo) Int8

func (f StrTo) Int8() (int8, error)

Int8 string to int8

func (*StrTo) Set

func (f *StrTo) Set(v string)

Set string

func (StrTo) String

func (f StrTo) String() string

String string to string

func (StrTo) Uint

func (f StrTo) Uint() (uint, error)

Uint string to uint

func (StrTo) Uint16

func (f StrTo) Uint16() (uint16, error)

Uint16 string to uint16

func (StrTo) Uint32

func (f StrTo) Uint32() (uint32, error)

Uint32 string to uint31

func (StrTo) Uint64

func (f StrTo) Uint64() (uint64, error)

Uint64 string to uint64

func (StrTo) Uint8

func (f StrTo) Uint8() (uint8, error)

Uint8 string to uint8

type UnixTime

type UnixTime timestamp.Timestamp

func (UnixTime) MarshalJSON

func (t UnixTime) MarshalJSON() ([]byte, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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