system

package
v0.0.0-...-0090c64 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ReflectUtils

type ReflectUtils struct{}

func (ReflectUtils) CreateNewInstance

func (ru ReflectUtils) CreateNewInstance(t reflect.Type, isReturnVal bool) interface{}

根据类型创建新的实体(指针或值) isReturnVal 是否以值返回,调用方为匿名类调用时必须返回值,true:返回'值';false:返回'指针' 注意:入参数 t不是匿名函数时不能使用 isReturnVal=true

func (ReflectUtils) DoMethod

func (ru ReflectUtils) DoMethod(object interface{}, name string, paramList ...interface{}) []reflect.Value

*

  • 利用反射执行函数
  • @param object 被修改属性的对象
  • @param name 属性名
  • @return

func (ReflectUtils) GetBaseEntity

func (ru ReflectUtils) GetBaseEntity(entity interface{}) interface{}

取实体对应父类实体(对应数据库)

func (ReflectUtils) GetFieldValue

func (ru ReflectUtils) GetFieldValue(object interface{}, name string) interface{}

*

  • 利用反射取属性值
  • @param object 被修改属性的对象
  • @param name 属性名
  • @return

func (ReflectUtils) GetMethod

func (ru ReflectUtils) GetMethod(object interface{}, name string) reflect.Value

*

  • 取函数
  • object 待检查对象
  • name 函数名

func (ReflectUtils) GetTagInfo

func (ru ReflectUtils) GetTagInfo(entry interface{}) map[string]reflect.StructTag

取结构体各属性的tag信息

func (ReflectUtils) GetTagInfoByName

func (ru ReflectUtils) GetTagInfoByName(entry interface{}, name string) reflect.StructTag

取结构体指定属性的tag信息

func (ReflectUtils) GetTypeName

func (ru ReflectUtils) GetTypeName(object interface{}) string

*

  • 利用反射取实际类型名称
  • @param object 被修改属性的对象
  • @return

func (ReflectUtils) HasField

func (ru ReflectUtils) HasField(object interface{}, name string, fieldPrefix ...string) bool

*

  • 判断字段是否存在
  • object 待检查对象
  • name 成员名
  • fieldPrefix 字段前缀(可不传)

func (ReflectUtils) HasMethod

func (ru ReflectUtils) HasMethod(object interface{}, name string) bool

*

  • 判断函数是否存在
  • object 待检查对象
  • name 函数名

func (ReflectUtils) HoldByEntity

func (ru ReflectUtils) HoldByEntity(entity interface{}, data map[string]interface{}, fieldPrefix ...string) map[string]interface{}

*

  • 按实体保留map中的数据
  • object 待检查对象
  • data 数据
  • fieldPrefix 字段前缀(可不传)

func (ReflectUtils) HoldByEntityToArray

func (ru ReflectUtils) HoldByEntityToArray(entity interface{}, data []string, fieldPrefix ...string) []string

*

  • 按实体保留切片中的数据
  • object 待检查对象
  • data 数据
  • fieldPrefix 字段前缀(可不传)

func (ReflectUtils) MakArray

func (ru ReflectUtils) MakArray(entity interface{}) interface{}

*

  • 动态创建数组
  • entity 结构参照

func (ReflectUtils) MakMap

func (ru ReflectUtils) MakMap(keyEntity interface{}, valEntity interface{}) interface{}

*

  • 动态创建数组
  • keyEntity 键结构参照
  • valEntity 值结构参照

func (ReflectUtils) RemoveByEntity

func (ru ReflectUtils) RemoveByEntity(entity interface{}, data map[string]interface{}, fieldPrefix ...string) map[string]interface{}

*

  • 按实体剔除map中的数据
  • object 待检查对象
  • data 数据
  • fieldPrefix 字段前缀(可不传)

func (ReflectUtils) RemoveByEntityToArray

func (ru ReflectUtils) RemoveByEntityToArray(entity interface{}, data []string, fieldPrefix ...string) []string

*

  • 按实体剔除切片中的数据
  • object 待检查对象
  • data 数据
  • fieldPrefix 字段前缀(可不传)

func (ReflectUtils) SetFieldInt

func (ru ReflectUtils) SetFieldInt(object interface{}, name string, val int)

*

  • 利用反射设置属性值
  • @param object 被修改属性的对象
  • @param name 属性名
  • @param val 值 字符串
  • @return

func (ReflectUtils) SetFieldString

func (ru ReflectUtils) SetFieldString(object interface{}, name string, val string)

*

  • 利用反射设置属性值
  • @param object 被修改属性的对象
  • @param name 属性名
  • @param val 值 字符串
  • @return

func (ReflectUtils) SetFieldValue

func (ru ReflectUtils) SetFieldValue(object interface{}, name string, val interface{})

*

  • 利用反射设置属性值
  • @param object 被修改属性的对象
  • @param name 属性名
  • @param val 值 不确定类型
  • @return

func (ReflectUtils) ToEntity

func (ru ReflectUtils) ToEntity(data []interface{}, entity interface{}) (interface{}, bool)

*

  • 数组转指定结构数组
  • data 待转换数据,结构: []map[string]interface{}
  • entity 结构参照,结构: []entity

func (ReflectUtils) ToEntityMap

func (ru ReflectUtils) ToEntityMap(data map[string]interface{}, entity interface{}, tt reflect.Type) (interface{}, bool)

*

  • 通用Map转指定结构Map
  • data 待转换Map,结构:
  • entity 结构参照

type RegisterUtil

type RegisterUtil struct{}

func (RegisterUtil) CreateRegisterCode

func (this RegisterUtil) CreateRegisterCode(registerSeries string) (string, error)

根据注册序列号创建注册码 registerSeries 注册序列号

func (RegisterUtil) GetCPUID

func (this RegisterUtil) GetCPUID() string

GetCPUID 获取cpuid

func (RegisterUtil) GetRegisterSeries

func (this RegisterUtil) GetRegisterSeries(key string) string

取注册中的序列号 key 干扰串

func (RegisterUtil) ValidCode

func (this RegisterUtil) ValidCode(registerSeries, key string) (bool, error)

根据注册序列号判断注册码是否正确 registerSeries 注册序列号 key 注册码

type SystemUtil

type SystemUtil struct{}

func (SystemUtil) AppMemoryInfo

func (su SystemUtil) AppMemoryInfo() map[string]interface{}

程序内存信息

func (SystemUtil) AppPath

func (su SystemUtil) AppPath() string

获取当前执行程序所在的绝对路径

func (SystemUtil) CheckPollCode

func (su SystemUtil) CheckPollCode(code, key string) (bool, error)

*

  • 验证注册码
  • @param code 注册码
  • @param key 干扰密钥
  • @return

func (SystemUtil) CheckPollCodeAndSerial

func (su SystemUtil) CheckPollCodeAndSerial(code, serial, key string) (bool, error)

*

  • 根据序列号验证注册码
  • @param code 注册码
  • @param serial 序列号
  • @param key 干扰密钥
  • @return

func (SystemUtil) CreatePollCode

func (su SystemUtil) CreatePollCode(key string) string

*

  • 取符合本机的注册码
  • @param key 干扰密钥
  • @return

func (SystemUtil) GetBaseBoardID

func (su SystemUtil) GetBaseBoardID() string

GetBaseBoardID 获取主板的id

func (SystemUtil) GetCPUID

func (su SystemUtil) GetCPUID() string

GetCPUID 获取cpuid

func (SystemUtil) GetCpuInfo

func (SystemUtil) GetCpuInfo() map[string]interface{}

取CPU占用信息

func (SystemUtil) GetCpuPercent

func (SystemUtil) GetCpuPercent() float64

func (SystemUtil) GetDiskFree

func (SystemUtil) GetDiskFree(p int) uint64

func (SystemUtil) GetDiskInfo

func (su SystemUtil) GetDiskInfo() []map[string]interface{}

取磁盘信息

func (SystemUtil) GetDiskPercent

func (SystemUtil) GetDiskPercent(p int) float64

func (SystemUtil) GetDiskTotal

func (SystemUtil) GetDiskTotal(p int) uint64

func (SystemUtil) GetMemInfo

func (su SystemUtil) GetMemInfo() map[string]interface{}

取内存信息

func (SystemUtil) GetMemPercent

func (SystemUtil) GetMemPercent() float64

func (SystemUtil) GetOsInfo

func (su SystemUtil) GetOsInfo() map[string]interface{}

取系统信息

func (SystemUtil) GetSystemSerial

func (su SystemUtil) GetSystemSerial() string

取系统序列号

Jump to

Keyboard shortcuts

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