kenan

package module
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2026 License: Apache-2.0 Imports: 33 Imported by: 0

README

kenan

kenan-golang开发框架

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RpcMapSync sync.Map

RpcMapSync 线程安全的Rpc客户端实例map

Functions

func DBG

func DBG(format string, a ...interface{})

func GetConfigDefault

func GetConfigDefault(key string, val ...string) string

GetConfigDefault 获取开放配置文件的值,为空则用默认值

func GetConfigDefaultByInt

func GetConfigDefaultByInt(key string, val ...int) int

GetConfigDefaultByInt 读取配置文件节点,整形

func Init

func Init(svrTag string, opts ...core.KenanOption) error

func LogError

func LogError(text string, args ...interface{})

LogError 错误日志

func LogInfo

func LogInfo(text string, args ...interface{})

func LogInit

func LogInit()

func LogWarn

func LogWarn(text string, args ...interface{})

LogWarn 警告日志

func OpenDB added in v1.0.1

func OpenDB(param DBParam) (*gorm.DB, error)

func ParsingLocalConfig

func ParsingLocalConfig()

func RPCXInit added in v1.0.8

func RPCXInit()

func RegisterMS added in v1.0.8

func RegisterMS(svrArity interface{}, port string, limits ...int64) error

RegisterMS 微服务注册 port注册端口

func ReturnErrorMap added in v1.0.8

func ReturnErrorMap(ack int, msg string) *map[string]interface{}

func ReturnSuccessMap added in v1.0.8

func ReturnSuccessMap(d interface{}) *map[string]interface{}

func RpcNewClient added in v1.0.8

func RpcNewClient(node string) (client.XClient, error)

RpcNewClient RPC客户端注册

func SetConfigFilePath

func SetConfigFilePath(path string) core.KenanOption

SetConfigFilePath 设置配置文件路径,比如‘./config.yaml’

func SetLogConfig

func SetLogConfig(pathPrefix string, rotationTime, maxAge time.Duration) core.KenanOption

SetLogConfig 设置日志配置

Types

type Args added in v1.0.8

type Args struct {
	HttpHeader http.Header
	Session    map[string]interface{}
	Data       interface{}
}

func (*Args) CallService added in v1.0.8

func (args *Args) CallService(node, fun string, data interface{}) (*Reply, error)

func (*Args) ComplexAnalysis added in v1.0.8

func (args *Args) ComplexAnalysis(body interface{}, headerObj interface{}) error

ComplexAnalysis 解析指定的复杂Data到内存对象

func (*Args) ComplexAnalysisSelf added in v1.0.8

func (args *Args) ComplexAnalysisSelf(headerObj interface{}) error

ComplexAnalysisSelf 解析来自调用方返回的复杂Data到内存对象

func (*Args) ReturnError added in v1.0.8

func (args *Args) ReturnError(ack int, msg string, reply *Reply) error

func (*Args) ReturnErrorNative added in v1.0.8

func (args *Args) ReturnErrorNative(ack int, msg string, reply *Reply) error

func (*Args) ReturnSuccess added in v1.0.8

func (args *Args) ReturnSuccess(d interface{}, reply *Reply) error

func (*Args) ReturnSuccessNative added in v1.0.8

func (args *Args) ReturnSuccessNative(d interface{}, reply *Reply, isByte ...bool) error

func (*Args) UseComplicated added in v1.0.8

func (args *Args) UseComplicated(body interface{}) []byte

UseComplicated 复杂对象转为[]byte

type ConnectionPlugin added in v1.0.8

type ConnectionPlugin struct {
}

ConnectionPlugin RPC连接插件

func (*ConnectionPlugin) HandleConnAccept added in v1.0.8

func (p *ConnectionPlugin) HandleConnAccept(conn net.Conn) (net.Conn, bool)

HandleConnAccept Rpc客户端连接

func (*ConnectionPlugin) HandleConnClose added in v1.0.8

func (p *ConnectionPlugin) HandleConnClose(conn net.Conn) bool

HandleConnClose Rpc客户端关闭

type DBParam added in v1.0.1

type DBParam struct {
	Host     string
	User     string
	Password string
	DBName   string
	Idle     int
	MaxConn  int
}

type RCParam added in v1.0.7

type RCParam struct {
	Host     string
	Password string
	DbIndex  int
}

type RedisClass added in v1.0.7

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

func OpenRedis added in v1.0.7

func OpenRedis(param RCParam) (*RedisClass, error)

OpenRedis 获取redis连接

func (*RedisClass) BRPopLPush added in v1.0.7

func (c *RedisClass) BRPopLPush(source, destination string) string

BRPopLPush BRPopLPush

func (*RedisClass) DeleteKey added in v1.0.7

func (c *RedisClass) DeleteKey(key string) bool

DeleteKey DeleteKey

func (*RedisClass) ExistsHashKey added in v1.0.7

func (c *RedisClass) ExistsHashKey(key string) bool

ExistsHashKey 更优雅的检查hash类型 key 是否存在

func (*RedisClass) ExistsStringKey added in v1.0.7

func (c *RedisClass) ExistsStringKey(key string) bool

ExistsStringKey 更优雅的检查string类型 key 是否存在

func (*RedisClass) GetIndexList added in v1.0.7

func (c *RedisClass) GetIndexList(key string, dx int64) string

GetIndexList 通过索引获取列表中的元素

func (*RedisClass) GetList added in v1.0.7

func (c *RedisClass) GetList(key string) []string

GetList GetList

func (*RedisClass) GetListLen added in v1.0.7

func (c *RedisClass) GetListLen(key string) int64

GetListLen GetListLen

func (*RedisClass) GetString added in v1.0.7

func (c *RedisClass) GetString(key string) string

GetString 获取KEY

func (*RedisClass) GetStringByInt added in v1.0.7

func (c *RedisClass) GetStringByInt(key string) int

func (*RedisClass) GetStringByInt64 added in v1.0.7

func (c *RedisClass) GetStringByInt64(key string) int64

func (*RedisClass) GetTTL added in v1.0.7

func (c *RedisClass) GetTTL(key string) *redis.DurationCmd

func (*RedisClass) HGet added in v1.0.7

func (c *RedisClass) HGet(key string, fields string) string

func (*RedisClass) HGetAll added in v1.0.7

func (c *RedisClass) HGetAll(key string) map[string]string

func (*RedisClass) HGetInt added in v1.0.7

func (c *RedisClass) HGetInt(key string, fields string) int

func (*RedisClass) HGetInt64 added in v1.0.7

func (c *RedisClass) HGetInt64(key string, fields string) int64

func (*RedisClass) HIncrBy added in v1.0.7

func (c *RedisClass) HIncrBy(key string, fields string, incr int64) error

HIncrBy HIncrBy

func (*RedisClass) HMGet added in v1.0.7

func (c *RedisClass) HMGet(key string, fields ...string) (map[string]string, error)

HMGet HMGet

func (*RedisClass) HMSet added in v1.0.7

func (c *RedisClass) HMSet(key string, kvPairs map[string]interface{}) error

HMSet HMSet

func (*RedisClass) HSet added in v1.0.7

func (c *RedisClass) HSet(key string, fields string, val string) error

HSet HSet

func (*RedisClass) HSetInt added in v1.0.7

func (c *RedisClass) HSetInt(key string, fields string, val int) error

HSetInt HSetInt

func (*RedisClass) HSetInt64 added in v1.0.7

func (c *RedisClass) HSetInt64(key string, fields string, val int64) error

HSetInt64 HSetInt64

func (*RedisClass) Incr added in v1.0.7

func (c *RedisClass) Incr(sKey string) int64

Incr 将 key 中储存的数字值增一

func (*RedisClass) LPopList added in v1.0.7

func (c *RedisClass) LPopList(key string) string

LPopList 移除并获取列表第一个元素

func (*RedisClass) PopList added in v1.0.7

func (c *RedisClass) PopList(key string) string

PopList 移除并获取列表最后一个元素

func (*RedisClass) PushList added in v1.0.7

func (c *RedisClass) PushList(key string, val string) error

PushList 存入队列(左进)

func (*RedisClass) PushLists added in v1.0.7

func (c *RedisClass) PushLists(key string, val []string) error

PushLists 多个值存入队列(左进)

func (*RedisClass) RPopLPush added in v1.0.7

func (c *RedisClass) RPopLPush(source, destination string) string

RPopLPush RPopLPush

func (*RedisClass) RemoveListAll added in v1.0.7

func (c *RedisClass) RemoveListAll(key, value string)

RemoveListAll 移除表中所有与 value 相等的值

func (*RedisClass) RunScript added in v1.0.7

func (c *RedisClass) RunScript(src string, keys []string, args ...interface{}) (interface{}, error)

func (*RedisClass) SAdd added in v1.0.7

func (c *RedisClass) SAdd(key string, fields string) int

func (*RedisClass) SCard added in v1.0.7

func (c *RedisClass) SCard(key string) int

func (*RedisClass) SIsMember added in v1.0.7

func (c *RedisClass) SIsMember(key, member string) bool

func (*RedisClass) SRandMember added in v1.0.7

func (c *RedisClass) SRandMember(key string) string

func (*RedisClass) SRem added in v1.0.7

func (c *RedisClass) SRem(key, member string) int

func (*RedisClass) SetIntExpire added in v1.0.7

func (c *RedisClass) SetIntExpire(key string, val int, expiration time.Duration) error

SetIntExpire 设置KEY值

func (*RedisClass) SetInterfaceExpire added in v1.0.7

func (c *RedisClass) SetInterfaceExpire(key string, val interface{}, expiration time.Duration) error

SetInterfaceExpire 设置KEY值

func (*RedisClass) SetNX added in v1.0.7

func (c *RedisClass) SetNX(key, val string, expiration time.Duration) (bool, error)

func (*RedisClass) SetPersist added in v1.0.7

func (c *RedisClass) SetPersist(key string) bool

SetPersist 将易失键转永久键

func (*RedisClass) SetString added in v1.0.7

func (c *RedisClass) SetString(key string, val string) error

SetString 设置KEY值

func (*RedisClass) SetStringExpire added in v1.0.7

func (c *RedisClass) SetStringExpire(key string, val string, expiration time.Duration) error

SetStringExpire 设置KEY值

func (*RedisClass) UpdateKeyExpire added in v1.0.7

func (c *RedisClass) UpdateKeyExpire(key string, expiration time.Duration) bool

UpdateKeyExpire 更新key过期时间

func (*RedisClass) ZAdd added in v1.0.7

func (c *RedisClass) ZAdd(key, member string, score float64) int64

func (*RedisClass) ZIncrBy added in v1.0.7

func (c *RedisClass) ZIncrBy(key, member string, increment int64) int

ZIncrBy ZIncrBy

func (*RedisClass) ZRangeByScore added in v1.0.7

func (c *RedisClass) ZRangeByScore(key, min, max string) []string

func (*RedisClass) ZRem added in v1.0.7

func (c *RedisClass) ZRem(key, member string) int64

ZRem 移除有序列表指定值

func (*RedisClass) ZScore added in v1.0.7

func (c *RedisClass) ZScore(key, member string) int

ZScore 获取有序列表分数

type Reply added in v1.0.8

type Reply struct {
	Success      bool
	Code         int
	ErrorMessage string
	Data         interface{}
}

func (*Reply) ComplexAnalysis added in v1.0.8

func (reply *Reply) ComplexAnalysis(headerObj interface{}) error

ComplexAnalysis 解析Call返回的复杂Data到内存对象

type Router added in v1.0.8

type Router struct {
	Ctx iris.Context
}

func (*Router) CallService added in v1.0.8

func (app *Router) CallService(serverPath, fun string, session map[string]interface{}) (*map[string]interface{}, error)

func (*Router) CallServiceReply added in v1.0.8

func (app *Router) CallServiceReply(serverPath, fun string, session map[string]interface{}) (*Reply, error)
func (app *Router) CreateNewLink(ctx iris.Context) error

func (*Router) ReturnToClientMap added in v1.0.8

func (app *Router) ReturnToClientMap(m1 *map[string]interface{}, statusCode ...int)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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