-
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
3 changed files
with
33 additions
and
46 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,27 @@ | ||
package dev.triumphteam.docsly.database.entity | ||
|
||
import dev.triumphteam.docsly.database.exposed.serializable | ||
import dev.triumphteam.docsly.serializable.DocElement | ||
import org.jetbrains.exposed.dao.LongEntity | ||
import org.jetbrains.exposed.dao.LongEntityClass | ||
import org.jetbrains.exposed.dao.id.EntityID | ||
import org.jetbrains.exposed.dao.id.IdTable | ||
import org.jetbrains.exposed.sql.Column | ||
|
||
public object DocsTable : IdTable<Long>() { | ||
public val guild: Column<Long> = long("guild_id").uniqueIndex() | ||
public val project: Column<String> = text("project").uniqueIndex() | ||
public val version: Column<String> = text("version").uniqueIndex() | ||
public val location: Column<String> = text("location").uniqueIndex() | ||
public val doc: Column<DocElement> = serializable("doc") | ||
|
||
override val primaryKey: PrimaryKey = PrimaryKey(guild, version, location) | ||
override val id: Column<EntityID<Long>> = guild.entityId() | ||
} | ||
|
||
public class DocEntity(entityId: EntityID<Long>) : LongEntity(entityId) { | ||
public companion object : LongEntityClass<DocEntity>(DocsTable) | ||
|
||
public var version: String by DocsTable.version | ||
public var guild: Long by DocsTable.guild | ||
} |
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