-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
813 additions
and
15 deletions.
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
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
Binary file not shown.
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
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
37 changes: 37 additions & 0 deletions
37
lib/src/main/kotlin/com/huanshankeji/exposed/datamapping/DataMapperInterfaces.kt
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,37 @@ | ||
package com.huanshankeji.exposed.datamapping | ||
|
||
import org.jetbrains.exposed.sql.Column | ||
import org.jetbrains.exposed.sql.ColumnSet | ||
import org.jetbrains.exposed.sql.ResultRow | ||
import org.jetbrains.exposed.sql.statements.UpdateBuilder | ||
|
||
fun interface SimpleNullableDataQueryMapper<Data> { | ||
fun resultRowToData(resultRow: ResultRow): Data | ||
} | ||
|
||
fun interface SimpleDataQueryMapper<Data : Any> : SimpleNullableDataQueryMapper<Data> | ||
|
||
fun interface NullableDataUpdateMapper<Data> { | ||
fun setUpdateBuilder(data: Data, updateBuilder: UpdateBuilder<*>) | ||
} | ||
|
||
fun interface DataUpdateMapper<Data : Any> : NullableDataUpdateMapper<Data> | ||
|
||
fun <Data : Any, ColumnSetT : ColumnSet> DataUpdateMapper<Data>.updateBuilderSetter(data: Data): | ||
ColumnSetT.(UpdateBuilder<*>) -> Unit = { | ||
setUpdateBuilder(data, it) | ||
} | ||
|
||
interface SimpleDataMapper<Data : Any> : SimpleDataQueryMapper<Data>, DataUpdateMapper<Data> | ||
|
||
|
||
interface NullableDataQueryMapper<Data> : SimpleNullableDataQueryMapper<Data> { | ||
val neededColumns: List<Column<*>> | ||
} | ||
|
||
interface DataQueryMapper<Data : Any> : NullableDataQueryMapper<Data> | ||
|
||
interface NullableDataMapper<Data> : NullableDataQueryMapper<Data>, NullableDataUpdateMapper<Data> | ||
|
||
// TODO rename to `NotNullDataMapper` | ||
interface DataMapper<Data : Any> : NullableDataMapper<Data>, DataQueryMapper<Data>, SimpleDataMapper<Data> |
Oops, something went wrong.