service-interface

interface of service

License

License

GroupId

GroupId

com.v1ok
ArtifactId

ArtifactId

service-interface
Last Version

Last Version

0.1.4
Release Date

Release Date

Type

Type

jar
Description

Description

service-interface
interface of service
Source Code Management

Source Code Management

https://github.com/liubinduo/uuid

Download service-interface

How to add to project

<!-- https://jarcasting.com/artifacts/com.v1ok/service-interface/ -->
<dependency>
    <groupId>com.v1ok</groupId>
    <artifactId>service-interface</artifactId>
    <version>0.1.4</version>
</dependency>
// https://jarcasting.com/artifacts/com.v1ok/service-interface/
implementation 'com.v1ok:service-interface:0.1.4'
// https://jarcasting.com/artifacts/com.v1ok/service-interface/
implementation ("com.v1ok:service-interface:0.1.4")
'com.v1ok:service-interface:jar:0.1.4'
<dependency org="com.v1ok" name="service-interface" rev="0.1.4">
  <artifact name="service-interface" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.v1ok', module='service-interface', version='0.1.4')
)
libraryDependencies += "com.v1ok" % "service-interface" % "0.1.4"
[com.v1ok/service-interface "0.1.4"]

Dependencies

compile (1)

Group / Artifact Type Version
org.springframework.data : spring-data-commons jar 1.13.9.RELEASE

Project Modules

There are no modules declared in this project.

uuid

这是一个生成UUID的工具,实现了两种标准的UUID。 uuid and snowflake

jar用法

IDGenerate idg = IDGenerateBuilder.builder(GenerateType.SNOWFLAKE)
                                  .setWorkerId(workerId)
                                  .setDataCenterId(dataCenterId)
                                  .setEpoch(epoch)
                                  .setBase(base)
                                  .build();

String id = idg.nextIdToString()  or long id = idg.nextIdtoLong();

Spring Boot 用法

在 pom.xml 引用

<dependency>
   <groupId>com.v1ok</groupId>
   <artifactId>uuid</artifactId>
   <version>${version}</version>
</dependency>

在application.properties文件中加入配置 uuid.type=snowflake 或者 uuid.type=uuid

@RestController
public class Demo {

  @Autowired
  IDGenerate generate;

  @GetMapping
  public Object test(){
    try {
      return generate.nextIdToLong();
    } catch (InterruptedException e) {
      e.printStackTrace();
    }
    return null;
  }
}

Config

uuid.type                   // UUID类型   取值范围:snowflake, uuid
uuid.snowflake.workerId     //机器ID       取值范围:(0~31)
uuid.snowflake.dataCenterId //数据中心ID   取值范围:(0~31)
uuid.snowflake.epoch        //纪元时间戳 
uuid.snowflake.base         //toString 时的进制数,取值范围:2~36

Versions

Version
0.1.4
0.1.3
0.1.2
0.1.1
0.1.0