🚧 Add jOOQ classes for the new database
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sun, 6 Apr 2025 06:13:03 +0000 (08:13 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sun, 6 Apr 2025 06:13:03 +0000 (08:13 +0200)
build.gradle
src/main/kotlin/net/pterodactylus/sone/database/h2/jooq/DefaultCatalog.kt [new file with mode: 0644]
src/main/kotlin/net/pterodactylus/sone/database/h2/jooq/Sone.kt [new file with mode: 0644]
src/main/kotlin/net/pterodactylus/sone/database/h2/jooq/keys/Keys.kt [new file with mode: 0644]
src/main/kotlin/net/pterodactylus/sone/database/h2/jooq/tables/Options.kt [new file with mode: 0644]
src/main/kotlin/net/pterodactylus/sone/database/h2/jooq/tables/records/OptionsRecord.kt [new file with mode: 0644]
src/main/kotlin/net/pterodactylus/sone/database/h2/jooq/tables/references/Tables.kt [new file with mode: 0644]

index 321c3da..27a35a0 100644 (file)
@@ -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 (file)
index 0000000..b978c39
--- /dev/null
@@ -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 <code>DEFAULT_CATALOG</code>
+         */
+        val DEFAULT_CATALOG = DefaultCatalog()
+    }
+
+    /**
+     * The schema <code>SONE</code>.
+     */
+    val SONE get() = Sone.SONE
+
+    override fun getSchemas(): List<Schema> = 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 (file)
index 0000000..59eb984
--- /dev/null
@@ -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 <code>SONE</code>
+         */
+        val SONE = Sone()
+    }
+
+    /**
+     * The table <code>SONE.OPTIONS</code>.
+     */
+    val OPTIONS get() = Options.OPTIONS
+
+    override fun getCatalog(): Catalog = DefaultCatalog.DEFAULT_CATALOG
+
+    override fun getTables(): List<Table<*>> = 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 (file)
index 0000000..aec336f
--- /dev/null
@@ -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<OptionsRecord> = 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 (file)
index 0000000..94d90e4
--- /dev/null
@@ -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<out Record>?,
+    path: ForeignKey<out Record, OptionsRecord>?,
+    aliased: Table<OptionsRecord>?,
+    parameters: Array<Field<*>?>?
+): TableImpl<OptionsRecord>(
+    alias,
+    Sone.SONE,
+    child,
+    path,
+    aliased,
+    parameters,
+    DSL.comment(""),
+    TableOptions.table()
+) {
+    companion object {
+
+        /**
+         * The reference instance of <code>SONE.OPTIONS</code>
+         */
+        val OPTIONS = Options()
+    }
+
+    /**
+     * The class holding records for this type
+     */
+    override fun getRecordType(): Class<OptionsRecord> = OptionsRecord::class.java
+
+    /**
+     * The column <code>SONE.OPTIONS.key</code>.
+     */
+    val KEY: TableField<OptionsRecord, String?> = createField(DSL.name("key"), SQLDataType.VARCHAR(21).nullable(false), this, "")
+
+    /**
+     * The column <code>SONE.OPTIONS.value</code>.
+     */
+    val VALUE: TableField<OptionsRecord, Int?> = createField(DSL.name("value"), SQLDataType.INTEGER.nullable(false), this, "")
+
+    private constructor(alias: Name, aliased: Table<OptionsRecord>?): this(alias, null, null, aliased, null)
+    private constructor(alias: Name, aliased: Table<OptionsRecord>?, parameters: Array<Field<*>?>?): this(alias, null, null, aliased, parameters)
+
+    /**
+     * Create an aliased <code>SONE.OPTIONS</code> table reference
+     */
+    constructor(alias: String): this(DSL.name(alias))
+
+    /**
+     * Create an aliased <code>SONE.OPTIONS</code> table reference
+     */
+    constructor(alias: Name): this(alias, null)
+
+    /**
+     * Create a <code>SONE.OPTIONS</code> table reference
+     */
+    constructor(): this(DSL.name("OPTIONS"), null)
+
+    constructor(child: Table<out Record>, key: ForeignKey<out Record, OptionsRecord>): this(Internal.createPathAlias(child, key), child, key, OPTIONS, null)
+    override fun getSchema(): Schema = Sone.SONE
+    override fun getPrimaryKey(): UniqueKey<OptionsRecord> = CONSTRAINT_E
+    override fun getKeys(): List<UniqueKey<OptionsRecord>> = 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<String?, Int?> = super.fieldsRow() as Row2<String?, Int?>
+}
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 (file)
index 0000000..f7311c5
--- /dev/null
@@ -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<OptionsRecord>(Options.OPTIONS), Record2<String?, Int?> {
+
+    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<String?> = super.key() as Record1<String?>
+
+    // -------------------------------------------------------------------------
+    // Record2 type implementation
+    // -------------------------------------------------------------------------
+
+    override fun fieldsRow(): Row2<String?, Int?> = super.fieldsRow() as Row2<String?, Int?>
+    override fun valuesRow(): Row2<String?, Int?> = super.valuesRow() as Row2<String?, Int?>
+    override fun field1(): Field<String?> = Options.OPTIONS.KEY
+    override fun field2(): Field<Int?> = 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 (file)
index 0000000..ea16b2a
--- /dev/null
@@ -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 <code>SONE.OPTIONS</code>.
+ */
+val OPTIONS = Options.OPTIONS