baseutils

package
v1.0.1-rel-02 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: AFL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func Any2Int64

func Any2Int64(value interface{}) int64

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 ContainsStru

func ContainsStru[T any](someStru interface{}) bool

func ContainsStruPtr

func ContainsStruPtr(someStru, childStru any) bool
func ContainsGometa(some interface{}) bool {
	return ContainsStru[basedto.Gometa](some)

}

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 FindNameOfIface

func FindNameOfIface(iface any) string

func FindPkgNameOfIface

func FindPkgNameOfIface(iface any) string

func FindStruNilPtrFields

func FindStruNilPtrFields(Stru any) []reflect.StructField

func FindStructFields

func FindStructFields(v any) []reflect.StructField

func FmtPrintLn

func FmtPrintLn(a ...interface{})

func FormatDatetime

func FormatDatetime(t time.Time) string

func FormatNow

func FormatNow() string

func GetBool

func GetBool(v bool) *bool

func GetInt

func GetInt(v int) *int

func GetInt16

func GetInt16(v int16) *int16

func GetInt32

func GetInt32(v int32) *int32

func GetInt64

func GetInt64(v int64) *int64

func GetInt8

func GetInt8(v int8) *int8

func GetString

func GetString(v string) *string

func GetTime

func GetTime(v time.Time) *time.Time

func GetTimeNow

func GetTimeNow() int64

获取时间

func IfBaseModel

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

func IfIface

func IfIface[T any](some any) bool

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 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 interface{}) string

func NewIchubLog

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

func NewIchubLogger

func NewIchubLogger(file string) *log.Logger
func CheckType(mock_irpc_check_allowed.go interface{}) string {
	switch mock_irpc_check_allowed.go.(type) {
	case string:
		return "string"
	case bool:
		return "bool"
	case int:
		return "int"
	case int8:
		return "int8"
	case int16:
		return "int16"
	case int32:
		return "int32"
	case int64:
		return "int64"
	case byte:
		return "byte"
	case float32:
		return "float32"
	case float64:
		return "float64"

	case *string:
		return "*string"
	case *bool:
		return "*bool"
	case *int:
		return "*int"
	case *int8:
		return "*int8"
	case *int16:
		return "*int16"
	case *int32:
		return "*int32"
	case *int64:
		return "*int64"
	case *byte:
		return "*byte"
	case *float32:
		return "*float32"
	case *float64:
		return "*float64"
	}

	return "none"
}

func NewOfPtrType

func NewOfPtrType[T baseiface.IpoolObj]() T

T is *type

func NewOfPtrTypeProxy

func NewOfPtrTypeProxy[T baseiface.IbaseProxy]() T

func NewOfType

func NewOfType[T baseiface.IpoolObj]() T

no used

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 PtrInt32ToString

func PtrInt32ToString(v *int32) string

func PtrInt64ToString

func PtrInt64ToString(v *int64) string

func PtrIntToString

func PtrIntToString(v *int) string

func Round

func Round(f float64, n int) float64

func SetFieldValue

func SetFieldValue(refValue reflect.Value, value any)

func SetFieldValues

func SetFieldValues(refValue reflect.Value, value any)

func SnowflakeNextVal

func SnowflakeNextVal() int64

func SnowflakeNextValStr

func SnowflakeNextValStr() string

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

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

type StruValue

type StruValue struct {
}

Jump to

Keyboard shortcuts

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