collect

package
v0.0.0-...-035e5cb Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2023 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const ItemName = "item"

Item name的名称

View Source
const RightName = "right"

Variables

This section is empty.

Functions

func CastValue

func CastValue(value interface{}, dataType string) interface{}

CastValue 根据类型转换值

func Copy

func Copy(src interface{}) interface{}

* 指针拷贝引用

func CopyMap

func CopyMap(src map[string]interface{}) map[string]interface{}

func CopyRecursive

func CopyRecursive(src, dst reflect.Value)

func CopyRecursivePtr

func CopyRecursivePtr(src, dst reflect.Value)

func CopyWithPtr

func CopyWithPtr(src interface{}) interface{}

* 指针也同时生成一份

func CreateDirs

func CreateDirs(path string) error

func CurrentDateFormat

func CurrentDateFormat(timeLayout string) string

func CurrentDateTime

func CurrentDateTime() string

func FileName

func FileName(filePath string) string

func GetAppKey

func GetAppKey(key string) string

func GetDataValueMapIter

func GetDataValueMapIter(name string, data interface{}) *reflect.MapIter

func GetDataValueStr

func GetDataValueStr(name string, data interface{}) string

* * 根据字符串,获取结构体里面字段值

func GetFieldValueList

func GetFieldValueList(fields []string, params map[string]interface{}) []string

func GetJSONData

func GetJSONData(value interface{}) string

func GetMapKeys

func GetMapKeys(data map[string]interface{}) []string

func GetMapValues

func GetMapValues(data map[string]interface{}) []interface{}

func GetRenderVarName

func GetRenderVarName(name string) string

func GetSafeData

func GetSafeData(name string, data map[string]interface{}) interface{}

* * 判断对象里面值是否为空 *

func GetServiceParam

func GetServiceParam(serviceParam map[string]interface{}, params map[string]interface{}, appendParam bool) map[string]interface{}

func IsArray

func IsArray(value any) bool

* * 判断是否为数组 *

func IsEmpty

func IsEmpty(name string, data map[string]interface{}) bool

* * 判断对象里面值是否为空 *

func IsMap

func IsMap(name string, data interface{}) bool

func IsMultipleField

func IsMultipleField(field string) bool

func IsPathExist

func IsPathExist(path string) bool

func IsRenderVar

func IsRenderVar(name string) bool

func IsValueEmpty

func IsValueEmpty(value any) bool

* * 判断值是否为空 *

func LoadAppProperties

func LoadAppProperties(path string)

func MultiplyJoin

func MultiplyJoin(content string, times int, sep string) string

* * 将字符串先乘以几次,然后以sep转成一个字符串 *

func MultiplyJoinComma

func MultiplyJoinComma(content string, times int) string

* * 将字符串先乘以几次,然后以逗号拼接转成一个字符串 *

func ParentDirName

func ParentDirName(filePath string) string

func ParseValueByField

func ParseValueByField(field reflect.Value, value interface{}) interface{}

ParseValueByField 根据model 里面的字段类型,转值

func ReadFileBytes

func ReadFileBytes(filePath string) ([]byte, bool)

* * 读取文件内容

func ReadFileContent

func ReadFileContent(filePath string) (string, bool)

* * 读取文件内容

func RenderTpl

func RenderTpl(Tpl *text_template.Template, params map[string]interface{}) string

RenderTpl 根据模板渲染数据

func RenderTplBool

func RenderTplBool(Tpl *text_template.Template, params map[string]interface{}) bool

func RenderTplData

func RenderTplData(Tpl *text_template.Template, params map[string]interface{}) interface{}

RenderTplData 根据模板渲染数据,优选取参数里面的字段

func RenderTplDataBool

func RenderTplDataBool(Tpl *text_template.Template, params map[string]interface{}) bool

func RenderTplDataWithType

func RenderTplDataWithType(Tpl *text_template.Template, params map[string]interface{}, dataType string) interface{}

RenderTplDataWithType 执行结果转类型

func RenderTplExec

func RenderTplExec(Tpl *text_template.Template, params map[string]interface{}, exec bool) interface{}
  • @param exec 是计算,是否执行运算结果
  • 比如计算分页 start: template: " ({{.page}}-1) * {{.size}}" exec: true type: int

func RenderVar

func RenderVar(name string, params map[string]interface{}) interface{}

func RenderVarOrValue

func RenderVarOrValue(name interface{}, params map[string]interface{}) interface{}

取参数变量、或者取值

func RenderVarToArrMap

func RenderVarToArrMap(name string, params map[string]interface{}) ([]map[string]interface{}, string)

func RenderVarToMap

func RenderVarToMap(name string, params map[string]interface{}) (map[string]interface{}, string)

func SetDataValue

func SetDataValue(name string, value interface{}, data interface{}) interface{}

* @name 字段名称 * @value 值 * @data 目标对象,可以是指针地址,也可以是目标对象 *

func SetDataValueByParams

func SetDataValueByParams(params map[string]interface{}, data interface{}, ignoreFields []string, updateFields []string, optionFields []string) (map[string]interface{}, []string)

func StringArrayContain

func StringArrayContain(list []string, value string) bool

func Strval

func Strval(value interface{}) string

Strval 获取变量的字符串值 浮点型 3.0将会转换成字符串3, "3" 非数值或字符类型的变量将会被转换成JSON格式字符串

func Throw

func Throw(up Exception)

func ToInt32

func ToInt32(value interface{}) int32

func ToSchemaName

func ToSchemaName(name string) string

func ToSqlNullTime

func ToSqlNullTime(value interface{}) sql.NullTime

func ToTime

func ToTime(value interface{}) time.Time

Types

type Block

type Block struct {
	Try     func()
	Catch   func(Exception)
	Finally func()
}

func (Block) Do

func (tcf Block) Do()

type Exception

type Exception interface{}

type Interface

type Interface interface {
	DeepCopy() interface{}
}

type Properties

type Properties struct {
	FileName string                 // 文件路径
	Data     map[string]interface{} // 数据
}

func (*Properties) GetKey

func (p *Properties) GetKey(key string) string

* ** 获取配置

func (*Properties) HasKey

func (p *Properties) HasKey(key string) bool

** 判断是否有值

func (*Properties) Load

func (p *Properties) Load()

* ** 获取配置

Jump to

Keyboard shortcuts

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