Documentation
¶
Index ¶
- Constants
- func GetInstanceID(uid uint64, prefix string) string
- func GetIntID() uint64
- func GetUUID36(prefix string) string
- func NewRequestID() string
- func NewSecretID() string
- func NewSecretKey() string
- func NewSpanID() string
- func NewTraceID() string
- type ID
- func (id ID) Equal(other ID) bool
- func (ID) GormDBDataType(db string) string
- func (id ID) IsZero() bool
- func (id ID) MarshalJSON() ([]byte, error)
- func (id *ID) Scan(src interface{}) error
- func (id ID) String() string
- func (id ID) Uint64() uint64
- func (id *ID) UnmarshalJSON(b []byte) error
- func (id ID) Value() (driver.Value, error)
Constants ¶
View Source
const ( Alphabet62 = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890" Alphabet36 = "abcdefghijklmnopqrstuvwxyz1234567890" )
62进制字母表
Variables ¶
This section is empty.
Functions ¶
func NewRequestID ¶ added in v0.2.7
func NewRequestID() string
NewRequestID 生成请求 ID 格式:req-{timestamp}-{random}
func NewTraceID ¶ added in v0.2.7
func NewTraceID() string
NewTraceID 生成追踪 ID(32位十六进制字符串) 格式:trace-{timestamp}-{random}
Types ¶
type ID ¶
type ID struct {
// contains filtered or unexported fields
}
func (ID) GormDBDataType ¶
GormDBDataType 实现 schema.GormDBDataTypeInterface,告诉 GORM 数据类型
func (ID) MarshalJSON ¶
MarshalJSON 实现 json.Marshaler 接口,输出数字
func (*ID) UnmarshalJSON ¶
UnmarshalJSON 实现 json.Unmarshaler 接口,接受数字
Click to show internal directories.
Click to hide internal directories.