This repository has been archived by the owner on May 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WEAV-31] ✨ UUID Creator Util 설정 (#7)
- Loading branch information
1 parent
7084c70
commit 2787095
Showing
3 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
support/common/src/main/kotlin/com/studentcenter/weave/support/common/uuid/UuidCreator.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.studentcenter.weave.support.common.uuid | ||
|
||
import java.util.* | ||
import com.github.f4b6a3.uuid.UuidCreator | ||
|
||
object UuidCreator { | ||
|
||
/** | ||
* uuid version 7 기반으로 uuid 를 생성합니다. | ||
* millisecond 단위로 정렬된 uuid 를 생성하며, | ||
* 동일한 시간에 생성될 경우 단조 증가 counter를 활용해, unique 하게 생성됩니다. | ||
* | ||
* @return uuid version 7 type 2 | ||
* @see <a href=https://datatracker.ietf.org/doc/draft-ietf-uuidrev-rfc4122bis>Universally Unique IDentifiers (UUID)</a> | ||
* @see UuidCreator.getTimeOrdered() | ||
* @author San Kim | ||
*/ | ||
fun create(): UUID { | ||
return UuidCreator.getTimeOrderedEpochPlus1() | ||
} | ||
|
||
} |