Categorygithub.com/jxohn/idGenerator
modulepackage
0.0.0-20210224033130-ccb55f1df273
Repository: https://github.com/jxohn/idgenerator.git
Documentation: pkg.go.dev

# README

#ID Generator

用go实现的id生成器, 支持每秒qps:131072, 超出需要等待下一秒

依赖

mysql(或zk,redis等)

需要使用mysql来保证多台机器获取到的workId不同 当然, 如果是单点, 那随意设置workId

使用介绍

init.sql

mysql的建表语句

config.json

在connect_info上添上连接mysql的信息

用法

    ring := NewRing(1<<17, GetWorkId("config.json"))
    id, err := ring.Take()

这里GetWorkId默认使用的是mysql, 你也可以使用zk等自定义的workId, 传入即可

# Functions

No description provided by the author
No description provided by the author
初始化flag数组.
No description provided by the author
No description provided by the author

# Constants

No description provided by the author
No description provided by the author

# Structs

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Interfaces

No description provided by the author

# Type aliases

No description provided by the author
No description provided by the author