helper

package
v0.0.0-...-42f099e Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2024 License: BSD-3-Clause Imports: 27 Imported by: 0

Documentation

Overview

Package provides some helping funcs, suchs as redis-related and settings parsing

Index

Constants

View Source
const (
	Limit  = 1 // 同時并行运行的goroutine上限
	Weight = 1 // 每个goroutine获取信号量资源的权重
)

Variables

View Source
var (
	/* 保存命令行context */
	HttpCmd *cobra.Command
)
View Source
var (
	Settings = configYaml{}
)

Settings read from local YAML setting file located in 'config/settings.yaml'

Functions

func AcquireSem

func AcquireSem(creator string)

获取信号量

func BroadcastTxWithRetry

func BroadcastTxWithRetry(clientCtx client.Context, msgs sdk.Msg) error

封装 GenerateOrBroadcastTxCLI, 延时 retry 5次, 约10秒

func CheckSign

func CheckSign(content []byte) (*map[string]interface{}, error)

接口验签,返回data数据

func Combined

Combined format: [<time>] <remote-addr> | <HTTP/http-version> | <method> <url> - <status> - <response-time us> | <user-agent> [2017/05/31 - 13:27:28] 127.0.0.1:54082 | HTTP/1.1 | GET /hello - 200 - 48.279µs | Paw/3.1.1 (Macintosh; OS X/10.12.5) GCDHTTPRequest

func FetchKey

func FetchKey(kb keyring.Keyring, keyref string) (*keyring.Record, error)
获取key信息

TODO: 这个函数只能检查本地存储的 keyring,如果验证用户地址需要是用 链上user数据

func InitSM2

func InitSM2()

func IsAlphanum

func IsAlphanum(word string) bool

func ReadSettings

func ReadSettings(yamlFilepath string)

func ReleaseSem

func ReleaseSem(creator string)

释放信号量

func RespError

func RespError(ctx *fasthttp.RequestCtx, code int, msg string)

func RespJson

func RespJson(ctx *fasthttp.RequestCtx, data *map[string]interface{})

处理返回值,返回json

Types

This section is empty.

Jump to

Keyboard shortcuts

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