Giter VIP home page Giter VIP logo

uid-generator-go's Introduction

Uid-Generator-GO

A Go version of Uid-Generator , a Snowflake based unique ID generator.

Status

Work in progress.

  • BaseGenerator(DefaultGenerator)
  • CachedGenerator

Welcome to open issues or pull requests to help me complete this project.

Difference

All code logic is the same as the Java version, but the following differences:

  • WorkerIDAssigner is not implemented, so you need to assign worker id by yourself.
  • Difference between Goroutines and Java Threads
  • ...

Usage

import "github.com/FAWC438/uid-generator-go"

...

There is a demo to show how to use BaseGenerator.

package test

import (
	"fmt"
	"uid-generator-go/generator"
)

func Test() {
	var gen generator.UidGenerator
	gen = generator.BaseGeneratorConstructor()

	uid, e := gen.GetUID()
	if e != nil {
		fmt.Println(e)
		return
	}
	fmt.Println(gen.ParseUID(uid))
}

Run this test and get your first awesome uid!

uid-generator-go's People

Contributors

fawc438 avatar

Stargazers

AtongM avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.