Documentation ¶
Index ¶
- Variables
- func AesCtrDecrypt(ciphertext string) (string, error)
- func AesCtrEncrypt(plaintext string) (string, error)
- func GetString(key string, funcName func(map[string]interface{}) (string, error), ...) (reply string, err error)
- func GetUUID() string
- func Handle(key string, funcName func(interface{}) error, data interface{}) error
- func Http(svr string, url string, method string, expQuery string, timeOut int, ...) (*xhttp.Res, error, *models.Response)
- func MultiHandle(key string, f []*Handler) error
- func NewConfigWithHashIDs(salt string, minLength int) jsoniter.API
- func RandString(n int) string
- func RasseHttp(svr string, url string, method string, expQuery string, timeOut int, ...) (*xhttp.Res, error, *models.Response)
- func RsaDecrypt(cypher string, key string) (string, error)
- func RsaEncrypt(msg string, key string) (string, error)
- func Split(s string, seps ...string) []string
- type Handler
- type HashIDsExtension
- type MyHash
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotInteger = errors.New("not integer")
Functions ¶
func AesCtrDecrypt ¶
aes解密,输入hex string格式的密文,返回string格式的明文
func AesCtrEncrypt ¶
支持16、24、32bytes的密钥 aes加密,输入string格式的明文,返回hex string格式的密文
func GetString ¶
func GetString(key string, funcName func(map[string]interface{}) (string, error), param map[string]interface{}) (reply string, err error)
GetString 从redis或db获取数据
func Http ¶
func Http(svr string, url string, method string, expQuery string, timeOut int, headers map[string]string, body string, ctx *context.BaseContext, fill bool, errDetail bool) (*xhttp.Res, error, *models.Response)
Http 带上下文的请求
func NewConfigWithHashIDs ¶
NewConfigWithHashIDs 初始化json序列化api
@param salt 密码加盐 @param minLength 密码长度 @return jsoniter.API 序列化API [Example] type Book struct { Id int `json:"id" hashids:"true"` Name string `json:"name"` } var json = jsonhashids.NewConfigWithHashIDs("93hs", 10) bytes, _ := json.Marshal(Book { Id: 1234, Name: "Jane Eyre", }) 输出: {"id":"gYEL5rKBnd","name":"Jane Eyre"}
func RandString ¶
func RasseHttp ¶
func RasseHttp(svr string, url string, method string, expQuery string, timeOut int, headers map[string]string, body string, ctx xcontext.XContext, fill bool, errDetail bool) (*xhttp.Res, error, *models.Response)
RasseHttp Rasse框架带上下文的请求
func RsaDecrypt ¶
私钥解密,输入hex string格式的密文,输出string格式的明文
func RsaEncrypt ¶
公钥加密,输入string格式的明文,输出hex string格式的密文
Types ¶
type Handler ¶
type Handler struct { FuncName func(*orm.FiTX, map[string]interface{}, interface{}) error Where map[string]interface{} Data interface{} }
Handler 数据增删改结构体
type HashIDsExtension ¶
type HashIDsExtension struct { jsoniter.DummyExtension // contains filtered or unexported fields }
HashIDsExtension hashId 扩展属性
func NewHashIDsExtension ¶
func NewHashIDsExtension(salt string, minLength int) *HashIDsExtension
NewHashIDsExtension 对id进行加盐
func (*HashIDsExtension) UpdateStructDescriptor ¶
func (extension *HashIDsExtension) UpdateStructDescriptor(structDescriptor *jsoniter.StructDescriptor)
UpdateStructDescriptor 更新结构体属性
type MyHash ¶
type MyHash struct {
*hashids.HashID
}
MyHash 自定义 hash 加密
func (*MyHash) HashDecodeInt ¶
HashDecodeInt 根据 hashID 规则 string covert to int,返回第一个数
[Example] myHash := utils.NewMyHash() hash := 8YNpqDDbVJ num, _ := myHash.HashDecodeInt(hash) 输出:num = 1035
func (*MyHash) HashEncodeInt ¶
HashEncodeInt 根据 hashID 规则 int covert to string
[Example] myHash := utils.NewMyHash() num := 1035 str := myHash.HashEncodeInt(num) 输出:str = 8YNpqDDbVJ
Click to show internal directories.
Click to hide internal directories.