feat: add codegen files

This commit is contained in:
Finn Linck Ryan 2025-12-13 23:40:19 +01:00
parent 5eb6fc4f78
commit df1870121f
14 changed files with 505 additions and 0 deletions

View file

@ -0,0 +1,24 @@
@file:Suppress("ktlint")
package gg.jte.generated.precompiled
import at.dokkae.homepage.templates.Index
@Suppress("UNCHECKED_CAST", "UNUSED_PARAMETER")
class JteIndexGenerated {
companion object {
@JvmField val JTE_NAME = "Index.kte"
@JvmField val JTE_LINE_INFO = intArrayOf(0,0,0,2,2,2,2,2,64,64,141,141,142,142,143,143,158,158,158,2,2,2,2,2)
@JvmStatic fun render(jteOutput:gg.jte.html.HtmlTemplateOutput, jteHtmlInterceptor:gg.jte.html.HtmlInterceptor?, model:Index) {
jteOutput.writeContent("\n<!doctype html>\n<html lang=\"en\">\n<head>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device-width,initial-scale=1\">\n <title>Simple Chat — http4k + JTE + htmx</title>\n\n <script src=\"https://cdn.jsdelivr.net/npm/htmx.org@2.0.8/dist/htmx.min.js\" integrity=\"sha384-/TgkGk7p307TH7EXJDuUlgG3Ce1UVolAOFopFekQkkXihi5u/6OCvVKyz1W+idaz\" crossorigin=\"anonymous\"></script>\n <script src=\"https://cdn.jsdelivr.net/npm/htmx-ext-sse@2.2.4\" integrity=\"sha384-A986SAtodyH8eg8x8irJnYUk7i9inVQqYigD6qZ9evobksGNIXfeFvDwLSHcp31N\" crossorigin=\"anonymous\"></script>\n\n <style>\n :root {\n --bg: #f5f5f7;\n --card: #ffffff;\n --border: #d0d0d5;\n --bubble-self: #daf0ff;\n --bubble-other: #ececec;\n --text-dark: #222;\n --text-light: #666;\n --radius: 12px;\n --spacing: 12px;\n --font: system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif;\n }\n\n body {\n margin: 0;\n font-family: var(--font);\n background: var(--bg);\n display: flex;\n justify-content: center;\n padding: 32px 12px;\n }\n\n #chat {\n width: 100%;\n max-width: 560px;\n background: var(--card);\n border: 1px solid var(--border);\n border-radius: var(--radius);\n padding: 20px;\n box-shadow: 0 4px 20px rgba(0,0,0,0.05);\n }\n\n h1 {\n margin: 0 0 16px;\n font-size: 1.4rem;\n color: var(--text-dark);\n text-align: center;\n }\n\n #messages {\n display: flex;\n flex-direction: column-reverse;\n gap: var(--spacing);\n margin-bottom: 20px;\n max-height: 60vh;\n overflow-y: auto;\n padding-right: 4px;\n }\n\n ")
jteOutput.writeContent("\n #messages::-webkit-scrollbar { width: 6px; }\n #messages::-webkit-scrollbar-thumb {\n background: #bbb;\n border-radius: 3px;\n }\n\n .message {\n padding: 10px 14px;\n border-radius: var(--radius);\n max-width: 85%;\n font-size: 0.95rem;\n line-height: 1.35;\n color: var(--text-dark);\n box-shadow: 0 1px 3px rgba(0,0,0,0.08);\n }\n\n .message-author {\n font-size: 0.8rem;\n font-weight: 600;\n margin-bottom: 4px;\n color: var(--text-light);\n }\n\n .message-self {\n align-self: flex-end;\n background: var(--bubble-self);\n }\n\n .message-other {\n align-self: flex-start;\n background: var(--bubble-other);\n }\n\n form {\n display: flex;\n gap: 8px;\n margin-bottom: 12px;\n }\n\n input[type=\"text\"] {\n flex: 1;\n padding: 10px;\n font-size: 1rem;\n border: 1px solid var(--border);\n border-radius: var(--radius);\n background: #fff;\n }\n\n button {\n padding: 10px 16px;\n background: #1e88ff;\n border: none;\n border-radius: var(--radius);\n color: white;\n font-size: 1rem;\n cursor: pointer;\n transition: 0.2s;\n }\n\n button:hover {\n background: #0c74e8;\n }\n\n p.note {\n font-size: 0.82rem;\n color: var(--text-light);\n margin-top: 14px;\n text-align: center;\n }\n </style>\n</head>\n<body hx-ext=\"sse\">\n<main id=\"chat\">\n <h1>Simple Chat</h1>\n\n <div id=\"messages\" sse-connect=\"/message-events\" sse-swap=\"message\" hx-swap=\"afterbegin\">\n ")
for (message in model.messages.reversed()) {
jteOutput.writeContent("\n ")
gg.jte.generated.precompiled.partials.JteMessageGenerated.render(jteOutput, jteHtmlInterceptor, message);
jteOutput.writeContent("\n ")
}
jteOutput.writeContent("\n </div>\n\n\n <form hx-post=\"/messages\" hx-swap=\"none\" hx-on::after-request=\"if(event.detail.successful)document.getElementById('message-input').value = ''\">\n <input id=\"username-input\" type=\"text\" name=\"author\" placeholder=\"name (optional)\">\n <input id=\"message-input\" type=\"text\" name=\"message\" placeholder=\"your message\" required>\n <button type=\"submit\">\n Send\n </button>\n </form>\n\n <p style=\"font-size: .9rem; color: #666\">No auth — anyone can post. Messages are stored only in memory.</p>\n</main>\n</body>\n</html>")
}
@JvmStatic fun renderMap(jteOutput:gg.jte.html.HtmlTemplateOutput, jteHtmlInterceptor:gg.jte.html.HtmlInterceptor?, params:Map<String, Any?>) {
val model = params["model"] as Index
render(jteOutput, jteHtmlInterceptor, model);
}
}
}

View file

@ -0,0 +1,26 @@
@file:Suppress("ktlint")
package gg.jte.generated.precompiled.partials
import at.dokkae.homepage.Message
@Suppress("UNCHECKED_CAST", "UNUSED_PARAMETER")
class JteMessageGenerated {
companion object {
@JvmField val JTE_NAME = "partials/Message.kte"
@JvmField val JTE_LINE_INFO = intArrayOf(0,0,0,2,2,2,2,2,5,5,5,5,6,6,6,8,8,8,10,10,10,2,2,2,2,2)
@JvmStatic fun render(jteOutput:gg.jte.html.HtmlTemplateOutput, jteHtmlInterceptor:gg.jte.html.HtmlInterceptor?, message:Message) {
jteOutput.writeContent("\n<div class=\"message\">\n <strong>")
jteOutput.setContext("strong", null)
jteOutput.writeUserContent(message.author)
jteOutput.writeContent("</strong>:\n ")
jteOutput.setContext("div", null)
jteOutput.writeUserContent(message.content)
jteOutput.writeContent("\n <span style=\"color:#888; font-size:.8rem;\">\n (")
jteOutput.setContext("span", null)
jteOutput.writeUserContent(message.createdAt.toString())
jteOutput.writeContent(")\n </span>\n</div>")
}
@JvmStatic fun renderMap(jteOutput:gg.jte.html.HtmlTemplateOutput, jteHtmlInterceptor:gg.jte.html.HtmlInterceptor?, params:Map<String, Any?>) {
val message = params["message"] as Message
render(jteOutput, jteHtmlInterceptor, message);
}
}
}

View file

@ -0,0 +1,43 @@
/*
* This file is generated by jOOQ.
*/
package at.dokkae.homepage.generated.jooq
import kotlin.collections.List
import org.jooq.Constants
import org.jooq.Schema
import org.jooq.impl.CatalogImpl
/**
* This class is generated by jOOQ.
*/
@Suppress("warnings")
open class DefaultCatalog : CatalogImpl("") {
companion object {
/**
* The reference instance of <code>DEFAULT_CATALOG</code>
*/
val DEFAULT_CATALOG: DefaultCatalog = DefaultCatalog()
}
/**
* standard public schema
*/
val PUBLIC: Public get(): Public = Public.PUBLIC
override fun getSchemas(): List<Schema> = listOf(
Public.PUBLIC
)
/**
* A reference to the 3.20 minor release of the code generator. If this
* doesn't compile, it's because the runtime library uses an older minor
* release, namely: 3.20. You can turn off the generation of this reference
* by specifying /configuration/generator/generate/jooqVersionReference
*/
private val REQUIRE_RUNTIME_JOOQ_VERSION = Constants.VERSION_3_20
}

View file

@ -0,0 +1,40 @@
/*
* This file is generated by jOOQ.
*/
package at.dokkae.homepage.generated.jooq
import at.dokkae.homepage.generated.jooq.tables.Message
import kotlin.collections.List
import org.jooq.Catalog
import org.jooq.Table
import org.jooq.impl.DSL
import org.jooq.impl.SchemaImpl
/**
* standard public schema
*/
@Suppress("warnings")
open class Public : SchemaImpl(DSL.name("public"), DefaultCatalog.DEFAULT_CATALOG, DSL.comment("standard public schema")) {
companion object {
/**
* The reference instance of <code>public</code>
*/
val PUBLIC: Public = Public()
}
/**
* The table <code>public.message</code>.
*/
val MESSAGE: Message get() = Message.MESSAGE
override fun getCatalog(): Catalog = DefaultCatalog.DEFAULT_CATALOG
override fun getTables(): List<Table<*>> = listOf(
Message.MESSAGE
)
}

View file

@ -0,0 +1,21 @@
@file:Suppress("warnings")
/*
* This file is generated by jOOQ.
*/
package at.dokkae.homepage.generated.jooq.keys
import at.dokkae.homepage.generated.jooq.tables.Message
import at.dokkae.homepage.generated.jooq.tables.records.MessageRecord
import org.jooq.UniqueKey
import org.jooq.impl.DSL
import org.jooq.impl.Internal
// -------------------------------------------------------------------------
// UNIQUE and PRIMARY KEY definitions
// -------------------------------------------------------------------------
val MESSAGE_PKEY: UniqueKey<MessageRecord> = Internal.createUniqueKey(Message.MESSAGE, DSL.name("message_pkey"), arrayOf(Message.MESSAGE.ID), true)

View file

@ -0,0 +1,187 @@
/*
* This file is generated by jOOQ.
*/
package at.dokkae.homepage.generated.jooq.tables
import at.dokkae.homepage.generated.jooq.Public
import at.dokkae.homepage.generated.jooq.keys.MESSAGE_PKEY
import at.dokkae.homepage.generated.jooq.tables.records.MessageRecord
import java.time.OffsetDateTime
import java.util.UUID
import kotlin.collections.Collection
import org.jooq.Condition
import org.jooq.Field
import org.jooq.ForeignKey
import org.jooq.InverseForeignKey
import org.jooq.Name
import org.jooq.PlainSQL
import org.jooq.QueryPart
import org.jooq.Record
import org.jooq.SQL
import org.jooq.Schema
import org.jooq.Select
import org.jooq.Stringly
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.SQLDataType
import org.jooq.impl.TableImpl
/**
* This class is generated by jOOQ.
*/
@Suppress("warnings")
open class Message(
alias: Name,
path: Table<out Record>?,
childPath: ForeignKey<out Record, MessageRecord>?,
parentPath: InverseForeignKey<out Record, MessageRecord>?,
aliased: Table<MessageRecord>?,
parameters: Array<Field<*>?>?,
where: Condition?
): TableImpl<MessageRecord>(
alias,
Public.PUBLIC,
path,
childPath,
parentPath,
aliased,
parameters,
DSL.comment(""),
TableOptions.table(),
where,
) {
companion object {
/**
* The reference instance of <code>public.message</code>
*/
val MESSAGE: Message = Message()
}
/**
* The class holding records for this type
*/
override fun getRecordType(): Class<MessageRecord> = MessageRecord::class.java
/**
* The column <code>public.message.id</code>.
*/
val ID: TableField<MessageRecord, UUID?> = createField(DSL.name("id"), SQLDataType.UUID.nullable(false), this, "")
/**
* The column <code>public.message.author</code>.
*/
val AUTHOR: TableField<MessageRecord, String?> = createField(DSL.name("author"), SQLDataType.VARCHAR(31).nullable(false), this, "")
/**
* The column <code>public.message.content</code>.
*/
val CONTENT: TableField<MessageRecord, String?> = createField(DSL.name("content"), SQLDataType.VARCHAR(255).nullable(false), this, "")
/**
* The column <code>public.message.created_at</code>.
*/
val CREATED_AT: TableField<MessageRecord, OffsetDateTime?> = createField(DSL.name("created_at"), SQLDataType.TIMESTAMPWITHTIMEZONE(6).nullable(false).defaultValue(DSL.field(DSL.raw("CURRENT_TIMESTAMP"), SQLDataType.TIMESTAMPWITHTIMEZONE)), this, "")
/**
* The column <code>public.message.updated_at</code>.
*/
val UPDATED_AT: TableField<MessageRecord, OffsetDateTime?> = createField(DSL.name("updated_at"), SQLDataType.TIMESTAMPWITHTIMEZONE(6), this, "")
private constructor(alias: Name, aliased: Table<MessageRecord>?): this(alias, null, null, null, aliased, null, null)
private constructor(alias: Name, aliased: Table<MessageRecord>?, parameters: Array<Field<*>?>?): this(alias, null, null, null, aliased, parameters, null)
private constructor(alias: Name, aliased: Table<MessageRecord>?, where: Condition?): this(alias, null, null, null, aliased, null, where)
/**
* Create an aliased <code>public.message</code> table reference
*/
constructor(alias: String): this(DSL.name(alias))
/**
* Create an aliased <code>public.message</code> table reference
*/
constructor(alias: Name): this(alias, null)
/**
* Create a <code>public.message</code> table reference
*/
constructor(): this(DSL.name("message"), null)
override fun getSchema(): Schema? = if (aliased()) null else Public.PUBLIC
override fun getPrimaryKey(): UniqueKey<MessageRecord> = MESSAGE_PKEY
override fun `as`(alias: String): Message = Message(DSL.name(alias), this)
override fun `as`(alias: Name): Message = Message(alias, this)
override fun `as`(alias: Table<*>): Message = Message(alias.qualifiedName, this)
/**
* Rename this table
*/
override fun rename(name: String): Message = Message(DSL.name(name), null)
/**
* Rename this table
*/
override fun rename(name: Name): Message = Message(name, null)
/**
* Rename this table
*/
override fun rename(name: Table<*>): Message = Message(name.qualifiedName, null)
/**
* Create an inline derived table from this table
*/
override fun where(condition: Condition?): Message = Message(qualifiedName, if (aliased()) this else null, condition)
/**
* Create an inline derived table from this table
*/
override fun where(conditions: Collection<Condition>): Message = where(DSL.and(conditions))
/**
* Create an inline derived table from this table
*/
override fun where(vararg conditions: Condition?): Message = where(DSL.and(*conditions))
/**
* Create an inline derived table from this table
*/
override fun where(condition: Field<Boolean?>?): Message = where(DSL.condition(condition))
/**
* Create an inline derived table from this table
*/
@PlainSQL override fun where(condition: SQL): Message = where(DSL.condition(condition))
/**
* Create an inline derived table from this table
*/
@PlainSQL override fun where(@Stringly.SQL condition: String): Message = where(DSL.condition(condition))
/**
* Create an inline derived table from this table
*/
@PlainSQL override fun where(@Stringly.SQL condition: String, vararg binds: Any?): Message = where(DSL.condition(condition, *binds))
/**
* Create an inline derived table from this table
*/
@PlainSQL override fun where(@Stringly.SQL condition: String, vararg parts: QueryPart): Message = where(DSL.condition(condition, *parts))
/**
* Create an inline derived table from this table
*/
override fun whereExists(select: Select<*>): Message = where(DSL.exists(select))
/**
* Create an inline derived table from this table
*/
override fun whereNotExists(select: Select<*>): Message = where(DSL.notExists(select))
}

View file

@ -0,0 +1,76 @@
/*
* This file is generated by jOOQ.
*/
package at.dokkae.homepage.generated.jooq.tables.pojos
import java.io.Serializable
import java.time.OffsetDateTime
import java.util.UUID
/**
* This class is generated by jOOQ.
*/
@Suppress("warnings")
data class Message(
val id: UUID,
val author: String,
val content: String,
val createdAt: OffsetDateTime? = null,
val updatedAt: OffsetDateTime? = null
): Serializable {
override fun equals(other: Any?): Boolean {
if (this === other)
return true
if (other == null)
return false
if (this::class != other::class)
return false
val o: Message = other as Message
if (this.id != o.id)
return false
if (this.author != o.author)
return false
if (this.content != o.content)
return false
if (this.createdAt == null) {
if (o.createdAt != null)
return false
}
else if (this.createdAt != o.createdAt)
return false
if (this.updatedAt == null) {
if (o.updatedAt != null)
return false
}
else if (this.updatedAt != o.updatedAt)
return false
return true
}
override fun hashCode(): Int {
val prime = 31
var result = 1
result = prime * result + this.id.hashCode()
result = prime * result + this.author.hashCode()
result = prime * result + this.content.hashCode()
result = prime * result + (if (this.createdAt == null) 0 else this.createdAt.hashCode())
result = prime * result + (if (this.updatedAt == null) 0 else this.updatedAt.hashCode())
return result
}
override fun toString(): String {
val sb = StringBuilder("Message (")
sb.append(id)
sb.append(", ").append(author)
sb.append(", ").append(content)
sb.append(", ").append(createdAt)
sb.append(", ").append(updatedAt)
sb.append(")")
return sb.toString()
}
}

View file

@ -0,0 +1,73 @@
/*
* This file is generated by jOOQ.
*/
package at.dokkae.homepage.generated.jooq.tables.records
import at.dokkae.homepage.generated.jooq.tables.Message
import java.time.OffsetDateTime
import java.util.UUID
import org.jooq.Record1
import org.jooq.impl.UpdatableRecordImpl
/**
* This class is generated by jOOQ.
*/
@Suppress("warnings")
open class MessageRecord private constructor() : UpdatableRecordImpl<MessageRecord>(Message.MESSAGE) {
open var id: UUID
set(value): Unit = set(0, value)
get(): UUID = get(0) as UUID
open var author: String
set(value): Unit = set(1, value)
get(): String = get(1) as String
open var content: String
set(value): Unit = set(2, value)
get(): String = get(2) as String
open var createdAt: OffsetDateTime?
set(value): Unit = set(3, value)
get(): OffsetDateTime? = get(3) as OffsetDateTime?
open var updatedAt: OffsetDateTime?
set(value): Unit = set(4, value)
get(): OffsetDateTime? = get(4) as OffsetDateTime?
// -------------------------------------------------------------------------
// Primary key information
// -------------------------------------------------------------------------
override fun key(): Record1<UUID?> = super.key() as Record1<UUID?>
/**
* Create a detached, initialised MessageRecord
*/
constructor(id: UUID, author: String, content: String, createdAt: OffsetDateTime? = null, updatedAt: OffsetDateTime? = null): this() {
this.id = id
this.author = author
this.content = content
this.createdAt = createdAt
this.updatedAt = updatedAt
resetTouchedOnNotNull()
}
/**
* Create a detached, initialised MessageRecord
*/
constructor(value: at.dokkae.homepage.generated.jooq.tables.pojos.Message?): this() {
if (value != null) {
this.id = value.id
this.author = value.author
this.content = value.content
this.createdAt = value.createdAt
this.updatedAt = value.updatedAt
resetTouchedOnNotNull()
}
}
}

View file

@ -0,0 +1,15 @@
@file:Suppress("warnings")
/*
* This file is generated by jOOQ.
*/
package at.dokkae.homepage.generated.jooq.tables.references
import at.dokkae.homepage.generated.jooq.tables.Message
/**
* The table <code>public.message</code>.
*/
val MESSAGE: Message = Message.MESSAGE