baseutils

package
v0.0.0-...-e3601d1 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2025 License: MulanPSL-2.0 Imports: 29 Imported by: 33

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MbTable = []uint16{}/* 256 elements not displayed */
View Source
var Types map[reflect.Type]string = map[reflect.Type]string{
	reflect.TypeOf(int8(0)): "int8",
}

Functions

func Any2Str

func Any2Str(value interface{}) string

func Autowired

func Autowired(some any) error

func CheckCrc

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

Modbus协议Crc校验

func CheckType

func CheckType(i interface{}) string

func ContainsGometa

func ContainsGometa(some any) bool

func ContainsStru

func ContainsStru[T any](someStru any) bool

func ContainsStruPtr

func ContainsStruPtr(someStru, childStru any) bool

func ContainsType

func ContainsType(s interface{}, name string) bool

func ContainsTypeOfSub

func ContainsTypeOfSub(s interface{}, name string) bool

func DesDec

func DesDec(c []byte, key []byte) ([]byte, error)

.. var tt, rrr = gdes.DecryptECB(r, []byte("12345678"), gdes.PKCS5PADDING)

func DesEnc

func DesEnc(c []byte, key []byte) ([]byte, error)

func FieldsFunc

func FieldsFunc(fieldsName string) []string

func FindNameOfIface

func FindNameOfIface(iface any) string

func FindStruNilPtrFields

func FindStruNilPtrFields(Stru any) []reflect.StructField

func FindStructFields

func FindStructFields(v any) []reflect.StructField

func FmtPrintLn

func FmtPrintLn(a ...any)

func FormatDatetime

func FormatDatetime(t time.Time) string

func FormatNow

func FormatNow() string

func GetTime

func GetTime() int64

获取时间

func IfBaseEntity

func IfBaseEntity(Some any) bool

func IfBaseModel

func IfBaseModel(some any) (baseiface.IbaseModel, bool)

func IfIface

func IfIface[T any](inst any) bool

// check inst impl interface T

func IfInterface

func IfInterface[T any](some any) (T, bool)

func IfNilPtrChild

func IfNilPtrChild(Stru any, feild string) bool

func IfProxy

func IfProxy(some any) bool

func IfPtrNil

func IfPtrNil(v any) bool

func IfStru

func IfStru(value any) bool

func IfTypeStru

func IfTypeStru(v reflect.Type) bool

func IfValueStru

func IfValueStru(v reflect.Value) bool

func InitStruNilPtrFields

func InitStruNilPtrFields(Stru any)

func LoadBeanProxy

func LoadBeanProxy[T baseiface.IbaseProxy]() T

func LoadIniCfg

func LoadIniCfg(fileName string) (*ini.File, error)

func MakeUnique

func MakeUnique(arr []int64) []int64

func Map2Str

func Map2Str(mapkey map[string]interface{}) strings.Builder

func MapKey2Str

func MapKey2Str(mapkey map[string]interface{}) strings.Builder

func ModbusCrcCheckSum

func ModbusCrcCheckSum(data []byte) []byte

func NameOfType

func NameOfType(v any) string

func NewIchubLog

func NewIchubLog(filename string) (logger *log.Logger)

func NewIchubLogger

func NewIchubLogger(pathfile string) *log.Logger

func NewOfPtrType

func NewOfPtrType[T baseiface.IpoolObj]() T

T is *type

func NewOfPtrTypeAny

func NewOfPtrTypeAny[T any]() T

func NewOfPtrTypeProxy

func NewOfPtrTypeProxy[T baseiface.IbaseProxy]() T

func NewOfType

func NewOfType[T baseiface.IpoolObj]() T

func NewProxyTypeOf

func NewProxyTypeOf(t reflect.Type) (baseiface.IbaseProxy, bool)

func NewStru

func NewStru[S any]() *S

func NewStruProxy

func NewStruProxy[S baseiface.IbaseProxy]() S

func Nipv4

func Nipv4() string

https://www.jianshu.com/p/982c4fabb11d swagg参数

func ParseArray2Map

func ParseArray2Map(stru []any) (any, error)

func Round

func Round(f float64, n int) float64

func SetFieldValue

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

func SnowflakeNextVal

func SnowflakeNextVal() int64

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 ToStruMap

func ToStruMap(src any, out any)

func UniqueId

func UniqueId() string

func Uuid

func Uuid() string

获取uuid

Types

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

Jump to

Keyboard shortcuts

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