lzqpkg

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LzgLogger = &LogConfig{}
View Source
var RedisUtil = redisUtil{}

Functions

func GetDefaultExpiresAt

func GetDefaultExpiresAt(expiration time.Duration) time.Duration

func GetRootPath

func GetRootPath() (path string, err error)

GetRootPath 获取项目根目录

func LogDebug

func LogDebug(msg string, obj ...interface{})

func LogError

func LogError(msg string, err error, obj ...interface{})

func LogInformation

func LogInformation(msg string, obj ...interface{})

func NewLzqLog

func NewLzqLog()

func RandomNum

func RandomNum(mix, max int) int

func StringToUuid

func StringToUuid(str string) (uuid.UUID, error)

func StructToJson

func StructToJson(obj interface{}) (string, error)

StructToJson struct转为json 这里对应的 N 和 A 不能为小写,首字母必须为大写,这样才可对外提供访问,具体 json 匹配是通过后面的 tag 标签进行匹配的,与 N 和 A 没有关系 tag 标签中 json 后面跟着的是字段名称,都是字符串类型,要求必须加上双引号,否则 golang 是无法识别它的类型

func StructToMap

func StructToMap(obj interface{}, oneSeries bool) map[string]interface{}

StructToMap struct转为map

func TimeToDateStr

func TimeToDateStr(time time.Time) string

func TimeToDateTimeStr

func TimeToDateTimeStr(time time.Time) string

func UrlJoint

func UrlJoint(path ...string) string

func UuidCreate

func UuidCreate() string

Types

type LogConfig

type LogConfig struct {
	ApplicationName   string `mapstructure:"ApplicationName"`
	UseElasticSearch  bool   `mapstructure:"UseElasticSearch"`
	ElasticSearchUrl  string `mapstructure:"ElasticSearchUrl"`
	ElasticSearchUser string `mapstructure:"ElasticSearchUser"`
	ElasticSearchPwd  string `mapstructure:"ElasticSearchPwd"`
}

type RedisConfig

type RedisConfig struct {
	RedisHost     string `mapstructure:"RedisHost"`
	RedisPwd      string `mapstructure:"RedisPwd"`
	RedisDB       int    `mapstructure:"RedisDB"`
	RedisPoolName string `mapstructure:"RedisPoolName"`
}

type RedisHelper

type RedisHelper struct {
	// contains filtered or unexported fields
}

func (*RedisHelper) Delete

func (r *RedisHelper) Delete(key string)

func (*RedisHelper) Get

func (r *RedisHelper) Get(key string) string

func (*RedisHelper) HDelete

func (r *RedisHelper) HDelete(key string, fields ...string) interface{}

func (*RedisHelper) HGet

func (r *RedisHelper) HGet(key, field string) interface{}

func (*RedisHelper) HGetAll

func (r *RedisHelper) HGetAll(key string) interface{}

func (*RedisHelper) HSet

func (r *RedisHelper) HSet(key, field string, value interface{}, duration time.Duration)

func (*RedisHelper) IncrBy

func (r *RedisHelper) IncrBy(key string, increment int64) int64

func (*RedisHelper) Keys

func (r *RedisHelper) Keys(pattern string) []string

func (*RedisHelper) MultiDelete

func (r *RedisHelper) MultiDelete(keys []string)

func (*RedisHelper) MultiGet

func (r *RedisHelper) MultiGet(keys []string) []interface{}

func (*RedisHelper) SSet

func (r *RedisHelper) SSet(key string, value interface{}, expiration time.Duration)

func (*RedisHelper) Set

func (r *RedisHelper) Set(key string, value interface{}, expiration time.Duration)

Jump to

Keyboard shortcuts

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