Skip to content
This repository has been archived by the owner on May 19, 2024. It is now read-only.

Commit

Permalink
[WEAV-31] ✨ UUID Creator Util 설정 (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
waterfogSW authored Jan 21, 2024
1 parent 7084c70 commit 2787095
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions buildSrc/src/main/kotlin/Version.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ object Version {
const val SONAR_CLOUD = "4.4.1.3373"

// dependencies
const val UUID_CREATOR = "5.3.3"
const val MOCKK = "1.13.7"
const val SPRING_MOCKK = "4.0.2"
const val KOTEST = "5.6.0"
Expand Down
4 changes: 4 additions & 0 deletions support/common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ val bootJar: BootJar by tasks

bootJar.enabled = false
jar.enabled = true

dependencies {
implementation("com.github.f4b6a3:uuid-creator:${Version.UUID_CREATOR}")
}
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()
}

}

0 comments on commit 2787095

Please sign in to comment.