generated from pricelees/issue-pr-template
[#48] Tosspay mocking 서버 구현을 위한 멀티모듈 전환 #49
@ -0,0 +1,13 @@
|
|||||||
|
package com.sangdol.common.persistence
|
||||||
|
|
||||||
|
import com.github.f4b6a3.tsid.TsidFactory
|
||||||
|
|
||||||
|
interface IDGenerator {
|
||||||
|
fun create(): Long
|
||||||
|
}
|
||||||
|
|
||||||
|
class TsidIDGenerator(
|
||||||
|
private val tsidFactory: TsidFactory
|
||||||
|
) : IDGenerator {
|
||||||
|
override fun create(): Long = tsidFactory.create().toLong()
|
||||||
|
}
|
||||||
@ -1,17 +0,0 @@
|
|||||||
package com.sangdol.roomescape.common.config
|
|
||||||
|
|
||||||
import com.github.f4b6a3.tsid.TsidFactory
|
|
||||||
import org.springframework.beans.factory.annotation.Value
|
|
||||||
import org.springframework.context.annotation.Bean
|
|
||||||
import org.springframework.context.annotation.Configuration
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
class TsidConfig {
|
|
||||||
@Value("\${POD_NAME:app-0}")
|
|
||||||
private lateinit var podName: String
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
fun tsidFactory(): TsidFactory = TsidFactory(podName.substringAfterLast("-").toInt())
|
|
||||||
}
|
|
||||||
|
|
||||||
fun TsidFactory.next(): Long = this.create().toLong()
|
|
||||||
Loading…
x
Reference in New Issue
Block a user