Documentation ¶
Overview ¶
Package util go实用库 RSA的签名及验签 SHA256 With RSA
Package util go实用库 RSA的签名及验签 SHA256 With RSA
Package util go实用库 安全散列算法SHA常用函数
Index ¶
- Constants
- func AddGlobalFields(name, mode string)
- func BaseCors(w http.ResponseWriter)
- func BaseMiddleware(next http.HandlerFunc) http.HandlerFunc
- func Ceil(v float64) float64
- func Date(s, layout string) (int64, error)
- func Floor(v float64) float64
- func GenerateUUID() (uuid string, err error)
- func LimitOffset(page, pageSize int32) (limit, offset uint64)
- func Localize(lang string, msgId string, templateData ...interface{}) string
- func MD5(s string) string
- func MobileEncode(mobile string) string
- func ParseTimeByUUID(uuid string) (dateTime string, err error)
- func RSA(src, privateKey string) (s string, err error)
- func RSACheck(src, sign, publicKey string) (ok bool, err error)
- func Random(min, max int64) int64
- func RandomNumber() int64
- func RandomStr(length int) string
- func RandomString(length int) string
- func RegisterLanguages(languages ...string)
- func Response(w http.ResponseWriter, resp interface{}, err error, code ...int)
- func Round(v float64, decimals int) float64
- func SHA256(s []byte) (r []byte, err error)
- func StringToTime(str, format string) (t time.Time, err error)
- func TimeToString(t time.Time, format string) string
- type BasicContext
- type Body
- type Client
- func (cli Client) Close() error
- func (cli Client) Delete(key string) (err error)
- func (cli Client) Get(key string) (value []byte, err error)
- func (cli Client) GetByPrefix(key string) (res []map[string][]byte, err error)
- func (cli Client) GetByPrefixDesc(key string) (res []map[string][]byte, err error)
- func (cli Client) GetConfig(serviceName string, mode string, prevision int64) (content string, version int64, err error)
- func (cli Client) GetOneByPrefix(keyPrefix string) (key string, value []byte, err error)
- func (cli Client) GetOneByPrefixDesc(keyPrefix string) (key string, value []byte, err error)
- func (cli Client) GetOneKeyByPrefix(keyPrefix string) (key string, err error)
- func (cli Client) GetOneKeyByPrefixDesc(keyPrefix string) (key string, err error)
- func (cli Client) GetPageListByPrefix(key string) (res []map[string][]byte, err error)
- func (cli Client) GetWithOption(key string, opts []clientv3.OpOption) (res []map[string][]byte, err error)
- func (cli Client) InitMerge(name, mode string, cPoint any) int64
- func (cli Client) Put(key, value string) error
- func (cli Client) Watch(serviceName, mode string, version int64, action func(string))
- type ErrorMsg
- type Lang
- type ModeVsersion
- type Service
- type ServiceConfig
Constants ¶
View Source
const ( ServiceInfoKeyPrefix = "service.info." ServiceConfigKeyPrefix = "service.config." )
Variables ¶
This section is empty.
Functions ¶
func AddGlobalFields ¶ added in v1.0.4
func AddGlobalFields(name, mode string)
func BaseCors ¶ added in v1.0.6
func BaseCors(w http.ResponseWriter)
func BaseMiddleware ¶ added in v1.0.6
func BaseMiddleware(next http.HandlerFunc) http.HandlerFunc
func LimitOffset ¶ added in v1.0.1
LimitOffset 用于获取sql分页的limit和offset
func ParseTimeByUUID ¶
ParseTimeByUUID 根据uuid, 获取生成该uuid的时间
func RegisterLanguages ¶ added in v1.1.1
func RegisterLanguages(languages ...string)
Types ¶
type BasicContext ¶ added in v1.0.6
type BasicContext string
const ( Token BasicContext = "token" UUID BasicContext = "uuid" Name BasicContext = "name" PageURI BasicContext = "pageURI" RequestURI BasicContext = "requestURI" SystemCode BasicContext = "systemCode" )
type Client ¶ added in v1.0.2
type Client struct {
// contains filtered or unexported fields
}
func NewEtcdCli ¶ added in v1.0.2
func (Client) GetByPrefix ¶ added in v1.0.2
func (Client) GetByPrefixDesc ¶ added in v1.0.2
获取key前缀的kv
func (Client) GetOneByPrefix ¶ added in v1.0.2
基于key降序获取key前缀的第一个kv
func (Client) GetOneByPrefixDesc ¶ added in v1.0.5
基于创建时间降序获取key前缀的第一个kv 其实 clientv3.WithSort(clientv3.SortByCreateRevision, clientv3.SortDescend) 可以去掉,默认也是按这个排序
func (Client) GetOneKeyByPrefix ¶ added in v1.0.2
基于key降序获取key前缀的第一个key
func (Client) GetOneKeyByPrefixDesc ¶ added in v1.0.5
基于创建时间降序获取key前缀的第一个key 其实 clientv3.WithSort(clientv3.SortByCreateRevision, clientv3.SortDescend) 可以去掉,默认也是按这个排序
func (Client) GetPageListByPrefix ¶ added in v1.0.2
func (Client) GetWithOption ¶ added in v1.0.2
func (cli Client) GetWithOption(key string, opts []clientv3.OpOption) (res []map[string][]byte, err error)
获取key前缀的kv
type ErrorMsg ¶ added in v1.0.8
func (*ErrorMsg) Response ¶ added in v1.0.9
func (e *ErrorMsg) Response(w http.ResponseWriter)
type Lang ¶ added in v1.1.1
type Lang interface { Localize(msgId string, templateData ...interface{}) string Error(removedPrefixMsgId string, templateData ...interface{}) error }
A Lang represents a lang.
func WithContext ¶ added in v1.1.1
WithContext sets ctx to lang, for keeping tracing information.
type ModeVsersion ¶ added in v1.0.2
type Service ¶ added in v1.0.2
type Service struct { Typ string `json:"type"` // 服务类型, api、rpc Summary string `json:"summary"` // 服务概述 CurrentVersion ModeVsersion `json:"currentVersion"` // 当前版本 }
Click to show internal directories.
Click to hide internal directories.