Skip to content

Commit

Permalink
chore: Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
KiKoS0 committed Feb 24, 2024
1 parent 0392add commit 27cb018
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
6 changes: 4 additions & 2 deletions inngest-core/src/main/kotlin/com/inngest/State.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@ class State(val payloadJson: String) {
sb.append(String.format("%02x", byte))
}
return sb.toString()

}

inline fun <reified T> getState(hashedId: String): T? = getState(hashedId, T::class.java)

fun <T> getState(hashedId: String, type: Class<T>): T? {
fun <T> getState(
hashedId: String,
type: Class<T>,
): T? {
val mapper = ObjectMapper()
val node: JsonNode = mapper.readTree(payloadJson)
val stepResult = node.path("steps").get(hashedId) ?: throw StateNotFound()
Expand Down
11 changes: 9 additions & 2 deletions inngest-core/src/main/kotlin/com/inngest/Step.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,16 @@ class Step(val state: State) {
* @param id unique step id for memoization
* @param fn the function to run
*/
inline fun <reified T> run(id: String, noinline fn: () -> T): T = run(id, fn, T::class.java)
inline fun <reified T> run(
id: String,
noinline fn: () -> T,
): T = run(id, fn, T::class.java)

fun <T> run(id: String, fn: () -> T, type: Class<T>): T {
fun <T> run(
id: String,
fn: () -> T,
type: Class<T>,
): T {
val hashedId = state.getHashFromId(id)

try {
Expand Down
1 change: 0 additions & 1 deletion inngest-spring-boot-demo/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,3 @@ dependencyManagement {
tasks.withType<Test> {
useJUnitPlatform()
}

0 comments on commit 27cb018

Please sign in to comment.