All Projects → freshcn → Go Id Builder

freshcn / Go Id Builder

这是一个ID生成器,它可以提供通过高效的方式产生连续的唯一的ID值。在分库分表时可以提供非常有用的帮助。

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Labels

Projects that are alternatives of or similar to Go Id Builder

Aiomysql
aiomysql is a library for accessing a MySQL database from the asyncio
Stars: ✭ 1,252 (+1339.08%)
Mutual labels:  mysql
Phpgrid Custom Crm
Custom CRM Demo - Learn to build yourself a custom CRM in PHP and MySQL, which a sales team can use to track customers through the entire sales cycle.
Stars: ✭ 85 (-2.3%)
Mutual labels:  mysql
Docker Superset
Repository for Docker Image of Apache-Superset. [Docker Image: https://hub.docker.com/r/abhioncbr/docker-superset]
Stars: ✭ 86 (-1.15%)
Mutual labels:  mysql
Ourbatis
Enhancement tools that make the development of Mybatis easier.
Stars: ✭ 84 (-3.45%)
Mutual labels:  mysql
Tp5 Api
前后端完全分离--服务端基于thinkphp5+mysql 接口解决方案
Stars: ✭ 85 (-2.3%)
Mutual labels:  mysql
Graphjin
GraphJin - Build APIs in 5 minutes with GraphQL. An instant GraphQL to SQL compiler.
Stars: ✭ 1,264 (+1352.87%)
Mutual labels:  mysql
Gh Ost
GitHub's Online Schema Migrations for MySQL
Stars: ✭ 9,523 (+10845.98%)
Mutual labels:  mysql
Swiff
💁 Command line tools for common local ↔ remote server tasks.
Stars: ✭ 87 (+0%)
Mutual labels:  mysql
Mern Social Network
A Notes App developed with MERN stack. Screenshots below. Visit the link for SPA version!! 📝 📒
Stars: ✭ 85 (-2.3%)
Mutual labels:  mysql
Docker Laravel
Laravel 5 with Dockerized Gulp, PHP-FPM, MySQL and nginx using docker-compose
Stars: ✭ 85 (-2.3%)
Mutual labels:  mysql
Canal mysql nosql sync
基于canal 的 mysql 与 redis/memcached/mongodb 的 nosql 数据实时同步方案 案例 demo canal client
Stars: ✭ 1,254 (+1341.38%)
Mutual labels:  mysql
Xeus Sql
xeus-sql is a Jupyter kernel for general SQL implementations.
Stars: ✭ 85 (-2.3%)
Mutual labels:  mysql
Jsql
jSQL is the "official" Javascript Query Language - A database written in Javascript for use in a browser or Node.
Stars: ✭ 85 (-2.3%)
Mutual labels:  mysql
Statemachineone
State Machine library for PHP
Stars: ✭ 84 (-3.45%)
Mutual labels:  mysql
Electrocrud
Database CRUD Application Built on Electron | MySQL, Postgres, SQLite
Stars: ✭ 1,267 (+1356.32%)
Mutual labels:  mysql
Hangfire.mysql.core
Hangfire Mysql storage components, support for. NET core 1.1,. NET core 2.0,. NET standard 2.0. Based on Hangfire.MySqlStorage, some bugs were fixed and .NET standard 2.0 support was provided.
Stars: ✭ 83 (-4.6%)
Mutual labels:  mysql
Sequelize Bookmarks
Sequelize ORM application with Express 4 server, Webpack and Vue.js
Stars: ✭ 85 (-2.3%)
Mutual labels:  mysql
Docker Lemp
🐳 Docker 快速搭建 LEMP 开发环境
Stars: ✭ 87 (+0%)
Mutual labels:  mysql
Clitools
🔧 CliTools for Docker, PHP / MySQL development, debugging and synchonization
Stars: ✭ 86 (-1.15%)
Mutual labels:  mysql
Mysql Colorize
Adds color for mysql tables
Stars: ✭ 85 (-2.3%)
Mutual labels:  mysql

go-id-builder

travis-ci

这是一个使用golang开发的ID生成器,它可以提供通过高效的方式产生连续唯一的ID值。在分库分表时可以提供非常有用的帮助。

为什么要做id生成器

常常在数据库进行分库分表的需求处理时,需要给表产生一个自增的主键id。单表的时候我们都是通过给表添加一个自增字段来实现的。当需要分表时就会发现这样的方式会出现每个表都有一套自己的自增id。特别是我们需要通过这个ID来实现分表算法时(一般都是id%表数量),那么如何在多表中产生一个连续自增的ID成为一个问题。

如何实现的

go-id-builder使用mysql来做为最大id数的持久化存储。程序在每次启动的时候都会加载数据表中当前的所记录的id类型,将会自动申请1000个(配置文件中可修改)新的id号,加载到一个缓冲通道中,当用户向生成器的api接口发起请求时,从对应的缓冲通道中将数据取出返回给客户端。

安装方式

你可以直接通过下面的命令来直接安装

go get github.com/freshcn/go-id-builder

db.sql中的数据表结构导入到你的 MYSQL 数据库中,在 app.ini 中配置你的mysql 数据的连接信息。

也可以通过项目的releases https://github.com/freshcn/go-id-builder/releases 中直接下载二进制包来安装运行

配置数据库

先将db.sql中的mysql语句安装到数据库中,并在app.ini中配置相应的mysql的数据库连接信息。数据库脚本中默认为表设置的是innodb引擎,你可以按需要修改为你正在使用的其他引擎。

数据库中已经默认提供了一个test id名,你可以在运行了程序后通过

http://localhost:3002?name=test

来获取到test这个id名所产生的第一个id值。

你可以向数据表中添加新的id名来支持新的id值的产生

api说明

在程序运行成功后默认会占用系统的3002端口,你可以在配置文件中修改所占用的端口号。

你可以通过get或post请求方式来请求接口。允许的参数如下表:

  • name - id值名
  • num - 需要请求的id数量,默认最大为100个,可在配置文件中修改
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].