add opportunity to use custom table names in content and post repos for exposed
This commit is contained in:
parent
13ddb106ad
commit
7d2b1772bb
@ -22,10 +22,11 @@ private val Content.type
|
|||||||
|
|
||||||
private class ContentRepoDatabaseTable(
|
private class ContentRepoDatabaseTable(
|
||||||
private val database: Database,
|
private val database: Database,
|
||||||
|
tableName: String = "",
|
||||||
private val textHolder: ContentHolderRepo<TextContent>,
|
private val textHolder: ContentHolderRepo<TextContent>,
|
||||||
private val binaryHolder: ContentHolderRepo<BinaryContent>,
|
private val binaryHolder: ContentHolderRepo<BinaryContent>,
|
||||||
private val specialHolder: ContentHolderRepo<SpecialContent>
|
private val specialHolder: ContentHolderRepo<SpecialContent>
|
||||||
) : Table("ContentRepo"), ContentRepo, ContentHolderRepo<Content> {
|
) : Table(tableName), ContentRepo, ContentHolderRepo<Content> {
|
||||||
internal val idColumn = text("_id")
|
internal val idColumn = text("_id")
|
||||||
internal val typeColumn = text("type")
|
internal val typeColumn = text("type")
|
||||||
|
|
||||||
@ -147,7 +148,8 @@ private class ContentRepoDatabaseTable(
|
|||||||
|
|
||||||
class ExposedContentRepo (
|
class ExposedContentRepo (
|
||||||
database: Database,
|
database: Database,
|
||||||
|
tableName: String = "",
|
||||||
textHolder: ContentHolderRepo<TextContent> = TextContentHolderRepo(database),
|
textHolder: ContentHolderRepo<TextContent> = TextContentHolderRepo(database),
|
||||||
binaryHolder: ContentHolderRepo<BinaryContent> = BinaryContentHolderRepo(database),
|
binaryHolder: ContentHolderRepo<BinaryContent> = BinaryContentHolderRepo(database),
|
||||||
specialHolder: ContentHolderRepo<SpecialContent> = SpecialContentHolderRepo(database)
|
specialHolder: ContentHolderRepo<SpecialContent> = SpecialContentHolderRepo(database)
|
||||||
) : ContentRepo by ContentRepoDatabaseTable(database, textHolder, binaryHolder, specialHolder)
|
) : ContentRepo by ContentRepoDatabaseTable(database, tableName, textHolder, binaryHolder, specialHolder)
|
||||||
|
@ -71,8 +71,9 @@ private class PostsRepoContentRelations(
|
|||||||
private val dateTimeFormat = DateFormat("EEE, dd MMM yyyy HH:mm:ss z")
|
private val dateTimeFormat = DateFormat("EEE, dd MMM yyyy HH:mm:ss z")
|
||||||
|
|
||||||
private class PostsRepoDatabaseTable(
|
private class PostsRepoDatabaseTable(
|
||||||
private val database: Database
|
private val database: Database,
|
||||||
) : PostsRepo, Table() {
|
tableName: String = ""
|
||||||
|
) : PostsRepo, Table(tableName) {
|
||||||
private val contentsTable = PostsRepoContentRelations(database)
|
private val contentsTable = PostsRepoContentRelations(database)
|
||||||
|
|
||||||
private val idColumn = text("postId")
|
private val idColumn = text("postId")
|
||||||
@ -210,5 +211,6 @@ private class PostsRepoDatabaseTable(
|
|||||||
}
|
}
|
||||||
|
|
||||||
class ExposedPostsRepo (
|
class ExposedPostsRepo (
|
||||||
database: Database
|
database: Database,
|
||||||
) : PostsRepo by PostsRepoDatabaseTable(database)
|
tableName: String = ""
|
||||||
|
) : PostsRepo by PostsRepoDatabaseTable(database, tableName)
|
||||||
|
Loading…
Reference in New Issue
Block a user