From 19b18dccdb0f2ac88bc99bd1d4e794ffccf64c90 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sun, 6 Apr 2025 08:13:03 +0200 Subject: [PATCH] =?utf8?q?=F0=9F=9A=A7=20Add=20jOOQ=20classes=20for=20the?= =?utf8?q?=20new=20database?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- build.gradle | 1 + .../sone/database/h2/jooq/DefaultCatalog.kt | 34 +++++++ .../pterodactylus/sone/database/h2/jooq/Sone.kt | 39 ++++++++ .../sone/database/h2/jooq/keys/Keys.kt | 20 ++++ .../sone/database/h2/jooq/tables/Options.kt | 111 +++++++++++++++++++++ .../h2/jooq/tables/records/OptionsRecord.kt | 72 +++++++++++++ .../database/h2/jooq/tables/references/Tables.kt | 14 +++ 7 files changed, 291 insertions(+) create mode 100644 src/main/kotlin/net/pterodactylus/sone/database/h2/jooq/DefaultCatalog.kt create mode 100644 src/main/kotlin/net/pterodactylus/sone/database/h2/jooq/Sone.kt create mode 100644 src/main/kotlin/net/pterodactylus/sone/database/h2/jooq/keys/Keys.kt create mode 100644 src/main/kotlin/net/pterodactylus/sone/database/h2/jooq/tables/Options.kt create mode 100644 src/main/kotlin/net/pterodactylus/sone/database/h2/jooq/tables/records/OptionsRecord.kt create mode 100644 src/main/kotlin/net/pterodactylus/sone/database/h2/jooq/tables/references/Tables.kt diff --git a/build.gradle b/build.gradle index 321c3da..27a35a0 100644 --- a/build.gradle +++ b/build.gradle @@ -57,6 +57,7 @@ dependencies { implementation group: 'org.jsoup', name: 'jsoup', version: '1.18.1' implementation group: 'io.dropwizard.metrics', name: 'metrics-core', version: '4.2.27' implementation group: 'jakarta.activation', name: 'jakarta.activation-api', version: '2.1.3' + implementation group: 'org.jooq', name: 'jooq', version: '3.14.16' testImplementation group: 'org.jetbrains.kotlin', name: 'kotlin-test-junit' testImplementation group: 'junit', name: 'junit', version: '4.13.2' diff --git a/src/main/kotlin/net/pterodactylus/sone/database/h2/jooq/DefaultCatalog.kt b/src/main/kotlin/net/pterodactylus/sone/database/h2/jooq/DefaultCatalog.kt new file mode 100644 index 0000000..b978c39 --- /dev/null +++ b/src/main/kotlin/net/pterodactylus/sone/database/h2/jooq/DefaultCatalog.kt @@ -0,0 +1,34 @@ +/* + * This file is generated by jOOQ. + */ +package net.pterodactylus.sone.database.h2.jooq + + +import kotlin.collections.List + +import org.jooq.Schema +import org.jooq.impl.CatalogImpl + + +/** + * This class is generated by jOOQ. + */ +@Suppress("UNCHECKED_CAST") +open class DefaultCatalog : CatalogImpl("") { + companion object { + + /** + * The reference instance of DEFAULT_CATALOG + */ + val DEFAULT_CATALOG = DefaultCatalog() + } + + /** + * The schema SONE. + */ + val SONE get() = Sone.SONE + + override fun getSchemas(): List = listOf( + Sone.SONE + ) +} diff --git a/src/main/kotlin/net/pterodactylus/sone/database/h2/jooq/Sone.kt b/src/main/kotlin/net/pterodactylus/sone/database/h2/jooq/Sone.kt new file mode 100644 index 0000000..59eb984 --- /dev/null +++ b/src/main/kotlin/net/pterodactylus/sone/database/h2/jooq/Sone.kt @@ -0,0 +1,39 @@ +/* + * This file is generated by jOOQ. + */ +package net.pterodactylus.sone.database.h2.jooq + + +import kotlin.collections.List + +import net.pterodactylus.sone.database.h2.jooq.tables.Options + +import org.jooq.Catalog +import org.jooq.Table +import org.jooq.impl.SchemaImpl + + +/** + * This class is generated by jOOQ. + */ +@Suppress("UNCHECKED_CAST") +open class Sone : SchemaImpl("SONE", DefaultCatalog.DEFAULT_CATALOG) { + companion object { + + /** + * The reference instance of SONE + */ + val SONE = Sone() + } + + /** + * The table SONE.OPTIONS. + */ + val OPTIONS get() = Options.OPTIONS + + override fun getCatalog(): Catalog = DefaultCatalog.DEFAULT_CATALOG + + override fun getTables(): List> = listOf( + Options.OPTIONS + ) +} diff --git a/src/main/kotlin/net/pterodactylus/sone/database/h2/jooq/keys/Keys.kt b/src/main/kotlin/net/pterodactylus/sone/database/h2/jooq/keys/Keys.kt new file mode 100644 index 0000000..aec336f --- /dev/null +++ b/src/main/kotlin/net/pterodactylus/sone/database/h2/jooq/keys/Keys.kt @@ -0,0 +1,20 @@ +/* + * This file is generated by jOOQ. + */ +package net.pterodactylus.sone.database.h2.jooq.keys + + +import net.pterodactylus.sone.database.h2.jooq.tables.Options +import net.pterodactylus.sone.database.h2.jooq.tables.records.OptionsRecord + +import org.jooq.UniqueKey +import org.jooq.impl.DSL +import org.jooq.impl.Internal + + + +// ------------------------------------------------------------------------- +// UNIQUE and PRIMARY KEY definitions +// ------------------------------------------------------------------------- + +val CONSTRAINT_E: UniqueKey = Internal.createUniqueKey(Options.OPTIONS, DSL.name("CONSTRAINT_E"), arrayOf(Options.OPTIONS.KEY), true) diff --git a/src/main/kotlin/net/pterodactylus/sone/database/h2/jooq/tables/Options.kt b/src/main/kotlin/net/pterodactylus/sone/database/h2/jooq/tables/Options.kt new file mode 100644 index 0000000..94d90e4 --- /dev/null +++ b/src/main/kotlin/net/pterodactylus/sone/database/h2/jooq/tables/Options.kt @@ -0,0 +1,111 @@ +/* + * This file is generated by jOOQ. + */ +package net.pterodactylus.sone.database.h2.jooq.tables + + +import kotlin.collections.List + +import net.pterodactylus.sone.database.h2.jooq.Sone +import net.pterodactylus.sone.database.h2.jooq.keys.CONSTRAINT_E +import net.pterodactylus.sone.database.h2.jooq.tables.records.OptionsRecord + +import org.jooq.Field +import org.jooq.ForeignKey +import org.jooq.Name +import org.jooq.Record +import org.jooq.Row2 +import org.jooq.Schema +import org.jooq.Table +import org.jooq.TableField +import org.jooq.TableOptions +import org.jooq.UniqueKey +import org.jooq.impl.DSL +import org.jooq.impl.Internal +import org.jooq.impl.SQLDataType +import org.jooq.impl.TableImpl + + +/** + * This class is generated by jOOQ. + */ +@Suppress("UNCHECKED_CAST") +open class Options( + alias: Name, + child: Table?, + path: ForeignKey?, + aliased: Table?, + parameters: Array?>? +): TableImpl( + alias, + Sone.SONE, + child, + path, + aliased, + parameters, + DSL.comment(""), + TableOptions.table() +) { + companion object { + + /** + * The reference instance of SONE.OPTIONS + */ + val OPTIONS = Options() + } + + /** + * The class holding records for this type + */ + override fun getRecordType(): Class = OptionsRecord::class.java + + /** + * The column SONE.OPTIONS.key. + */ + val KEY: TableField = createField(DSL.name("key"), SQLDataType.VARCHAR(21).nullable(false), this, "") + + /** + * The column SONE.OPTIONS.value. + */ + val VALUE: TableField = createField(DSL.name("value"), SQLDataType.INTEGER.nullable(false), this, "") + + private constructor(alias: Name, aliased: Table?): this(alias, null, null, aliased, null) + private constructor(alias: Name, aliased: Table?, parameters: Array?>?): this(alias, null, null, aliased, parameters) + + /** + * Create an aliased SONE.OPTIONS table reference + */ + constructor(alias: String): this(DSL.name(alias)) + + /** + * Create an aliased SONE.OPTIONS table reference + */ + constructor(alias: Name): this(alias, null) + + /** + * Create a SONE.OPTIONS table reference + */ + constructor(): this(DSL.name("OPTIONS"), null) + + constructor(child: Table, key: ForeignKey): this(Internal.createPathAlias(child, key), child, key, OPTIONS, null) + override fun getSchema(): Schema = Sone.SONE + override fun getPrimaryKey(): UniqueKey = CONSTRAINT_E + override fun getKeys(): List> = listOf(CONSTRAINT_E) + override fun `as`(alias: String): Options = Options(DSL.name(alias), this) + override fun `as`(alias: Name): Options = Options(alias, this) + + /** + * Rename this table + */ + override fun rename(name: String): Options = Options(DSL.name(name), null) + + /** + * Rename this table + */ + override fun rename(name: Name): Options = Options(name, null) + + // ------------------------------------------------------------------------- + // Row2 type methods + // ------------------------------------------------------------------------- + override fun fieldsRow(): Row2 = super.fieldsRow() as Row2 +} diff --git a/src/main/kotlin/net/pterodactylus/sone/database/h2/jooq/tables/records/OptionsRecord.kt b/src/main/kotlin/net/pterodactylus/sone/database/h2/jooq/tables/records/OptionsRecord.kt new file mode 100644 index 0000000..f7311c5 --- /dev/null +++ b/src/main/kotlin/net/pterodactylus/sone/database/h2/jooq/tables/records/OptionsRecord.kt @@ -0,0 +1,72 @@ +/* + * This file is generated by jOOQ. + */ +package net.pterodactylus.sone.database.h2.jooq.tables.records + + +import net.pterodactylus.sone.database.h2.jooq.tables.Options + +import org.jooq.Field +import org.jooq.Record1 +import org.jooq.Record2 +import org.jooq.Row2 +import org.jooq.impl.UpdatableRecordImpl + + +/** + * This class is generated by jOOQ. + */ +@Suppress("UNCHECKED_CAST") +open class OptionsRecord() : UpdatableRecordImpl(Options.OPTIONS), Record2 { + + var key: String? + set(value) = set(0, value) + get() = get(0) as String? + + var value: Int? + set(value) = set(1, value) + get() = get(1) as Int? + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + override fun key(): Record1 = super.key() as Record1 + + // ------------------------------------------------------------------------- + // Record2 type implementation + // ------------------------------------------------------------------------- + + override fun fieldsRow(): Row2 = super.fieldsRow() as Row2 + override fun valuesRow(): Row2 = super.valuesRow() as Row2 + override fun field1(): Field = Options.OPTIONS.KEY + override fun field2(): Field = Options.OPTIONS.VALUE + override fun component1(): String? = key + override fun component2(): Int? = value + override fun value1(): String? = key + override fun value2(): Int? = value + + override fun value1(value: String?): OptionsRecord { + this.key = value + return this + } + + override fun value2(value: Int?): OptionsRecord { + this.value = value + return this + } + + override fun values(value1: String?, value2: Int?): OptionsRecord { + this.value1(value1) + this.value2(value2) + return this + } + + /** + * Create a detached, initialised OptionsRecord + */ + constructor(key: String? = null, value: Int? = null): this() { + this.key = key + this.value = value + } +} diff --git a/src/main/kotlin/net/pterodactylus/sone/database/h2/jooq/tables/references/Tables.kt b/src/main/kotlin/net/pterodactylus/sone/database/h2/jooq/tables/references/Tables.kt new file mode 100644 index 0000000..ea16b2a --- /dev/null +++ b/src/main/kotlin/net/pterodactylus/sone/database/h2/jooq/tables/references/Tables.kt @@ -0,0 +1,14 @@ +/* + * This file is generated by jOOQ. + */ +package net.pterodactylus.sone.database.h2.jooq.tables.references + + +import net.pterodactylus.sone.database.h2.jooq.tables.Options + + + +/** + * The table SONE.OPTIONS. + */ +val OPTIONS = Options.OPTIONS -- 2.7.4