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

[WEAV-31] ✨ UUID Creator Util 설정 #7

Merged
merged 2 commits into from
Jan 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.*
dojinyou marked this conversation as resolved.
Show resolved Hide resolved
import com.github.f4b6a3.uuid.UuidCreator

object UuidCreator {
dojinyou marked this conversation as resolved.
Show resolved Hide resolved

/**
* 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()
}

}