-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added uuid to java.util.UUID Type Mapper (#202)
- Loading branch information
Showing
4 changed files
with
60 additions
and
1 deletion.
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
43 changes: 43 additions & 0 deletions
43
cli/src/test/resources/gen/uuid-column-type-generator.expected.txt
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,43 @@ | ||
package com.foo | ||
|
||
import java.sql.PreparedStatement | ||
import java.sql.ResultSet | ||
import java.time.OffsetDateTime | ||
import java.util.UUID | ||
import kotlin.String | ||
import kotlin.Unit | ||
import norm.ParamSetter | ||
import norm.Query | ||
import norm.RowMapper | ||
|
||
public class FooParams | ||
|
||
public class FooParamSetter : ParamSetter<FooParams> { | ||
public override fun map(ps: PreparedStatement, params: FooParams): Unit { | ||
} | ||
} | ||
|
||
public data class FooResult( | ||
public val id: UUID, | ||
public val columnName: String?, | ||
public val oldValue: String?, | ||
public val newValue: String?, | ||
public val capturedAt: OffsetDateTime? | ||
) | ||
|
||
public class FooRowMapper : RowMapper<FooResult> { | ||
public override fun map(rs: ResultSet): FooResult = FooResult( | ||
id = rs.getObject("id") as java.util.UUID, | ||
columnName = rs.getObject("column_name") as kotlin.String?, | ||
oldValue = rs.getObject("old_value") as kotlin.String?, | ||
newValue = rs.getObject("new_value") as kotlin.String?, | ||
capturedAt = rs.getObject("captured_at") as java.time.OffsetDateTime?) | ||
} | ||
|
||
public class FooQuery : Query<FooParams, FooResult> { | ||
public override val sql: String = "SELECT * FROM logs" | ||
|
||
public override val mapper: RowMapper<FooResult> = FooRowMapper() | ||
|
||
public override val paramSetter: ParamSetter<FooParams> = FooParamSetter() | ||
} |
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