mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-07 17:18:24 +08:00
add KeyGenerators.java
This commit is contained in:
parent
37aab2c951
commit
bf629721d1
@ -30,9 +30,9 @@ public class KeyGeneratorFactory {
|
||||
/** 内置了 uuid 的生成器,因此主键配置的时候可以直接配置为 @Id(keyType = KeyType.Generator, value = "uuid")
|
||||
* {@link com.mybatisflex.annotation.Id}
|
||||
*/
|
||||
register("uuid", new UUIDKeyGenerator());
|
||||
register("flexId", new FlexIDKeyGenerator());
|
||||
register("snowFlakeId", new SnowFlakeIDKeyGenerator());
|
||||
register(KeyGenerators.uuid, new UUIDKeyGenerator());
|
||||
register(KeyGenerators.flexId, new FlexIDKeyGenerator());
|
||||
register(KeyGenerators.snowFlakeId, new SnowFlakeIDKeyGenerator());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,37 @@
|
||||
/**
|
||||
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
|
||||
* <p>
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* <p>
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.mybatisflex.core.keygen;
|
||||
|
||||
public class KeyGenerators {
|
||||
|
||||
/**
|
||||
* uuid 主键生成器
|
||||
* {@link com.mybatisflex.core.keygen.impl.UUIDKeyGenerator}
|
||||
*/
|
||||
public static final String uuid = "uuid";
|
||||
|
||||
/**
|
||||
* flexId 主键生成器
|
||||
* {@link com.mybatisflex.core.keygen.impl.FlexIDKeyGenerator}
|
||||
*/
|
||||
public static final String flexId = "flexId";
|
||||
|
||||
/**
|
||||
* 雪花算法主键生成器
|
||||
* {@link com.mybatisflex.core.keygen.impl.SnowFlakeIDKeyGenerator}
|
||||
*/
|
||||
public static final String snowFlakeId = "snowFlakeId";
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user