util

package
v1.11.1 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DigInvoke

func DigInvoke(function interface{}, opts ...dig.InvokeOption) error

DigInvoke ...

func DigProvide

func DigProvide(constructor interface{}, opts ...dig.ProvideOption) error

DigProvide ...

func Go added in v1.4.0

func Go(du time.Duration, fn func(context.Context))

Go ...

func ReadConfig

func ReadConfig(v interface{}, path ...string)

ReadConfig 指定配置文件并解析; 未指定配置文件则通过环境变量获取

func StringSliceHas added in v1.8.0

func StringSliceHas(sl []string, v string) bool

StringSliceHas ...

Types

type HID

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

HID 基于 HMAC 算法,将内部 int64 的 ID 与 base64 URL 字符串进行相互转换。API 接口不支持 int64 ID 参数。

func NewHID

func NewHID(key []byte) *HID

NewHID 根据给定的秘钥生成 HID 实例。

func (*HID) ToHex

func (h *HID) ToHex(i int64) string

ToHex 将内部 ID(大于0的 int64)转换成24位 base64 URL 字符串。 如果输入值 <= 0,则返回空字符串。

func (*HID) ToInt64

func (h *HID) ToInt64(s string) int64

ToInt64 将合法的24位 base64 URL 字符串转换成内部 ID(大于0的 int64)。 如果输入值不合法,则返回0。

Jump to

Keyboard shortcuts

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