snowflake

package
v0.0.0-...-97366e3 Latest Latest
Warning

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

Go to latest
Published: May 5, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BUFFER_LEN = 100
)

Variables

View Source
var (
	RpcName = etc.Etc.String("cmd/snowflake", "rpc_name")
)

Functions

This section is empty.

Types

type GenArg

type GenArg struct {
	// 需要取的ID数,需要大于0
	BufferLen int
}

type GenRet

type GenRet struct {
	// 返回对应的ID数量,数量与需要传入的Buffer值大小相同
	ID []int64
}

func Gen

func Gen(arg *GenArg) (*GenRet, error)

获取服务器生成的序列ID

type ID

type ID int64

func New

func New() (ID, error)

读取一个新的ID

func NewBuffer

func NewBuffer(l int) ([]ID, error)

读取多个新的ID 若返回成功,返回的数组长度与请求的长度一致

func ParseID

func ParseID(in string) (ID, error)

func (*ID) Scan

func (u *ID) Scan(v interface{}) error

for database

func (ID) String

func (u ID) String() string

func (*ID) Value

func (c *ID) Value() (driver.Value, error)

type RpcService

type RpcService interface {
	Gen(arg *GenArg, ret *GenRet) error
}

Rpc exported method

Jump to

Keyboard shortcuts

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