snowflake-uid | Distributed UID generator based on snowflake algorithm

 by   johnhuang-cn Java Version: Current License: MIT

kandi X-RAY | snowflake-uid Summary

kandi X-RAY | snowflake-uid Summary

snowflake-uid is a Java library. snowflake-uid has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has low support. You can download it from GitHub.

Distributed UID generator based on snowflake algorithm
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              snowflake-uid has a low active ecosystem.
              It has 24 star(s) with 15 fork(s). There are 2 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              snowflake-uid has no issues reported. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of snowflake-uid is current.

            kandi-Quality Quality

              snowflake-uid has 0 bugs and 0 code smells.

            kandi-Security Security

              snowflake-uid has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              snowflake-uid code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              snowflake-uid is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              snowflake-uid releases are not available. You will need to build from source code and install.
              Build file is available. You can build the component from source.
              Installation instructions, examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi has reviewed snowflake-uid and discovered the below as its top functions. This is intended to give you an instant insight into snowflake-uid implemented functionality, and help decide if they suit your requirements.
            • Get a unique identifier
            • Gets next uid
            • Get current second second
            • Returns the next millisecond
            • Get a worker id by ip
            • Convert an IPv4 string to long
            • Parse a UID from worker id
            • Format date by pattern
            • Parse date by day pattern
            • Format date by day pattern
            Get all kandi verified functions for this library.

            snowflake-uid Key Features

            No Key Features are available at this moment for snowflake-uid.

            snowflake-uid Examples and Code Snippets

            No Code Snippets are available at this moment for snowflake-uid.

            Community Discussions

            No Community Discussions are available at this moment for snowflake-uid.Refer to stack overflow page for discussions.

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install snowflake-uid

            Download the project and import This project haven't post to maven repo, so please download/clone this project and run "mvn install" to install it to local maven repo.
            Add maven dependency to project <dependency> <groupId>net.xdevelop</groupId> <artifactId>snowflake-uid</artifactId> <version>1.0.0</version> </dependency>
            Init the bean @Configuration public class UIDConfig { @Bean public SnowflakeUidGenerator customerUidGenerator() { long workerId = SnowflakeUidGenerator.getWorkerIdByIP(24); return new SnowflakeUidGenerator(workerId); } // init multiple uid generators for different DB tables @Bean public SnowflakeUidGenerator orderUidGenerator() { long workerId = SnowflakeUidGenerator.getWorkerIdByIP(24); return new SnowflakeUidGenerator(workerId); } }
            Generate the uid @Component public class CustomerService { @Autowired CustomerMapper mapper; @Autowired @Qualifier("customerUidGenerator") SnowflakeUidGenerator uidGenerator; public void addCustomer(Customer customer) { customer.setCustomerId(uidGenerator.getUID()); long curTime = System.currentTimeMillis(); customer.setCreatedDate(curTime); customer.setLastModifiedDate(curTime); mapper.insert(customer); } }
            Optional: customize the generator @Configuration public class UIDConfig { @Bean public SnowflakeUidGenerator customerUidGenerator() { long workerId = SnowflakeUidGenerator.getWorkerIdByIP(16); String baseDate = "2018-08-01"; int timeBits = 32; int workerBits = 16; int seqBits = 15; return new SnowflakeUidGenerator(workerId, baseDate, timeBits, workerBits, seqBits); } }
            This project haven't post to maven repo, so please download/clone this project and run "mvn install" to install it to local maven repo.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/johnhuang-cn/snowflake-uid.git

          • CLI

            gh repo clone johnhuang-cn/snowflake-uid

          • sshUrl

            git@github.com:johnhuang-cn/snowflake-uid.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Consider Popular Java Libraries

            CS-Notes

            by CyC2018

            JavaGuide

            by Snailclimb

            LeetCodeAnimation

            by MisterBooo

            spring-boot

            by spring-projects

            Try Top Libraries by johnhuang-cn

            spring-cloud-k8s-ci-template

            by johnhuang-cnJava

            jpserve

            by johnhuang-cnJava

            AngularSEO

            by johnhuang-cnCSS

            FancyBing

            by johnhuang-cnJava

            TPCTransaction

            by johnhuang-cnJava