All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jooq.kotlin.Extensions.kt Maven / Gradle / Ivy

The newest version!
package org.jooq.kotlin

import org.jetbrains.annotations.Blocking
import org.jooq.*
import org.jooq.conf.*
import org.jooq.impl.DSL.*
import org.jooq.migrations.xml.jaxb.*
import org.jooq.util.xml.jaxb.*
import java.util.stream.Collector

// ----------------------------------------------------------------------------
// Extensions to collect Field> into other types
// ----------------------------------------------------------------------------

fun  Field>.collecting(collector: Collector): Field = convertFrom { it.collect(collector) }

inline fun  Field>>.intoArray(): Field> = collecting(Records.intoArray(E::class.java))

inline fun  Field>.intoArray(noinline mapper: (R) -> E): Field> = collecting(Records.intoArray(E::class.java, mapper))

fun > Field>.intoGroups(): Field>> = collecting(Records.intoGroups())

fun  Field>.intoGroups(keyMapper: (R) -> K): Field>> = collecting(Records.intoGroups(keyMapper))

fun  Field>.intoGroups(keyMapper: (R) -> K, valueMapper: (R) -> V): Field>> = collecting(Records.intoGroups(keyMapper, valueMapper))

fun > Field>.intoList(): Field> = collecting(Records.intoList())

fun  Field>.intoList(mapper: (R) -> E): Field> = collecting(Records.intoList(mapper))

fun  Field>>.intoMap(): Field> = collecting(Records.intoMap())

fun  Field>.intoMap(keyMapper: (R) -> K): Field> = collecting(Records.intoMap(keyMapper))

fun  Field>.intoMap(keyMapper: (R) -> K, valueMapper: (R) -> V): Field> = collecting(Records.intoMap(keyMapper, valueMapper))

fun  Field>.intoResultGroups(keyMapper: (R) -> K): Field>> = collecting(Records.intoResultGroups(keyMapper))

fun  Field>.intoResultGroups(keyMapper: (R) -> K, valueMapper: (R) -> V): Field>> = collecting(Records.intoResultGroups(keyMapper, valueMapper))

fun > Field>.intoSet(): Field> = collecting(Records.intoSet())

fun  Field>.intoSet(mapper: (R) -> E): Field> = collecting(Records.intoSet(mapper))

// ----------------------------------------------------------------------------
// Extensions to collect ResultQuery into other types
// ----------------------------------------------------------------------------

@Blocking
inline fun  ResultQuery>.fetchArray(): Array = collect(Records.intoArray(E::class.java))

@Blocking
fun > ResultQuery.fetchGroups(): Map> = collect(Records.intoGroups())

@Blocking
fun > ResultQuery.fetchList(): List = collect(Records.intoList())

@Blocking
fun  ResultQuery>.fetchMap(): Map = collect(Records.intoMap())

@Blocking
fun > ResultQuery.fetchSet(): Set = collect(Records.intoSet())

@Blocking
fun > ResultQuery.fetchValue(): E? = fetchOne { it.value1() }

@Blocking
fun > ResultQuery.fetchSingleValue(): E = fetchSingle { it.value1() }

// ----------------------------------------------------------------------------
// Extensions to collect Result into other types
// ----------------------------------------------------------------------------

inline fun  Result>.intoArray(): Array = collect(Records.intoArray(E::class.java))

fun > Result.intoGroups(): Map> = collect(Records.intoGroups())

fun > Result.intoList(): List = collect(Records.intoList())

fun  Result>.intoMap(): Map = collect(Records.intoMap())

fun > Result.intoSet(): Set = collect(Records.intoSet())



// ----------------------------------------------------------------------------
// Extensions to map Field> to more convenient Field>
// As well as Field to Field
// ----------------------------------------------------------------------------

// [jooq-tools] START [mapping]

@JvmName("mappingRecord")
fun  Field>.mapping(f: Function1): Field = convertFrom { Records.mapping(f).apply(it) }

@JvmName("mappingRecord")
fun  Field>.mapping(f: Function2): Field = convertFrom { Records.mapping(f).apply(it) }

@JvmName("mappingRecord")
fun  Field>.mapping(f: Function3): Field = convertFrom { Records.mapping(f).apply(it) }

@JvmName("mappingRecord")
fun  Field>.mapping(f: Function4): Field = convertFrom { Records.mapping(f).apply(it) }

@JvmName("mappingRecord")
fun  Field>.mapping(f: Function5): Field = convertFrom { Records.mapping(f).apply(it) }

@JvmName("mappingRecord")
fun  Field>.mapping(f: Function6): Field = convertFrom { Records.mapping(f).apply(it) }

@JvmName("mappingRecord")
fun  Field>.mapping(f: Function7): Field = convertFrom { Records.mapping(f).apply(it) }

@JvmName("mappingRecord")
fun  Field>.mapping(f: Function8): Field = convertFrom { Records.mapping(f).apply(it) }

@JvmName("mappingRecord")
fun  Field>.mapping(f: Function9): Field = convertFrom { Records.mapping(f).apply(it) }

@JvmName("mappingRecord")
fun  Field>.mapping(f: Function10): Field = convertFrom { Records.mapping(f).apply(it) }

@JvmName("mappingRecord")
fun  Field>.mapping(f: Function11): Field = convertFrom { Records.mapping(f).apply(it) }

@JvmName("mappingRecord")
fun  Field>.mapping(f: Function12): Field = convertFrom { Records.mapping(f).apply(it) }

@JvmName("mappingRecord")
fun  Field>.mapping(f: Function13): Field = convertFrom { Records.mapping(f).apply(it) }

@JvmName("mappingRecord")
fun  Field>.mapping(f: Function14): Field = convertFrom { Records.mapping(f).apply(it) }

@JvmName("mappingRecord")
fun  Field>.mapping(f: Function15): Field = convertFrom { Records.mapping(f).apply(it) }

@JvmName("mappingRecord")
fun  Field>.mapping(f: Function16): Field = convertFrom { Records.mapping(f).apply(it) }

@JvmName("mappingRecord")
fun  Field>.mapping(f: Function17): Field = convertFrom { Records.mapping(f).apply(it) }

@JvmName("mappingRecord")
fun  Field>.mapping(f: Function18): Field = convertFrom { Records.mapping(f).apply(it) }

@JvmName("mappingRecord")
fun  Field>.mapping(f: Function19): Field = convertFrom { Records.mapping(f).apply(it) }

@JvmName("mappingRecord")
fun  Field>.mapping(f: Function20): Field = convertFrom { Records.mapping(f).apply(it) }

@JvmName("mappingRecord")
fun  Field>.mapping(f: Function21): Field = convertFrom { Records.mapping(f).apply(it) }

@JvmName("mappingRecord")
fun  Field>.mapping(f: Function22): Field = convertFrom { Records.mapping(f).apply(it) }

fun  Field>>.mapping(f: Function1): Field> = convertFrom { it.map(Records.mapping(f)) }

fun  Field>>.mapping(f: Function2): Field> = convertFrom { it.map(Records.mapping(f)) }

fun  Field>>.mapping(f: Function3): Field> = convertFrom { it.map(Records.mapping(f)) }

fun  Field>>.mapping(f: Function4): Field> = convertFrom { it.map(Records.mapping(f)) }

fun  Field>>.mapping(f: Function5): Field> = convertFrom { it.map(Records.mapping(f)) }

fun  Field>>.mapping(f: Function6): Field> = convertFrom { it.map(Records.mapping(f)) }

fun  Field>>.mapping(f: Function7): Field> = convertFrom { it.map(Records.mapping(f)) }

fun  Field>>.mapping(f: Function8): Field> = convertFrom { it.map(Records.mapping(f)) }

fun  Field>>.mapping(f: Function9): Field> = convertFrom { it.map(Records.mapping(f)) }

fun  Field>>.mapping(f: Function10): Field> = convertFrom { it.map(Records.mapping(f)) }

fun  Field>>.mapping(f: Function11): Field> = convertFrom { it.map(Records.mapping(f)) }

fun  Field>>.mapping(f: Function12): Field> = convertFrom { it.map(Records.mapping(f)) }

fun  Field>>.mapping(f: Function13): Field> = convertFrom { it.map(Records.mapping(f)) }

fun  Field>>.mapping(f: Function14): Field> = convertFrom { it.map(Records.mapping(f)) }

fun  Field>>.mapping(f: Function15): Field> = convertFrom { it.map(Records.mapping(f)) }

fun  Field>>.mapping(f: Function16): Field> = convertFrom { it.map(Records.mapping(f)) }

fun  Field>>.mapping(f: Function17): Field> = convertFrom { it.map(Records.mapping(f)) }

fun  Field>>.mapping(f: Function18): Field> = convertFrom { it.map(Records.mapping(f)) }

fun  Field>>.mapping(f: Function19): Field> = convertFrom { it.map(Records.mapping(f)) }

fun  Field>>.mapping(f: Function20): Field> = convertFrom { it.map(Records.mapping(f)) }

fun  Field>>.mapping(f: Function21): Field> = convertFrom { it.map(Records.mapping(f)) }

fun  Field>>.mapping(f: Function22): Field> = convertFrom { it.map(Records.mapping(f)) }

// [jooq-tools] END [mapping]

// ----------------------------------------------------------------------------
// Extensions to make Field a Condition
// ----------------------------------------------------------------------------

@Support
fun Field.and(other: Condition): Condition = condition(this).and(other)

@Support
fun Field.and(other: Field): Condition = condition(this).and(other)

@Support
@PlainSQL
fun Field.and(sql: SQL): Condition = condition(this).and(sql)

@Support
@PlainSQL
fun Field.and(sql: String): Condition = condition(this).and(sql)

@Support
@PlainSQL
fun Field.and(sql: String, vararg bindings: Any): Condition = condition(this).and(sql, bindings)

@Support
@PlainSQL
fun Field.and(sql: String, vararg parts: QueryPart): Condition = condition(this).and(sql, parts)

@Support
fun Field.andNot(other: Condition): Condition = condition(this).andNot(other)

@Support
fun Field.andNot(other: Field): Condition = condition(this).andNot(other)

@Support
fun Field.andExists(select: Select<*>): Condition = condition(this).andExists(select)

@Support
fun Field.andNotExists(select: Select<*>): Condition = condition(this).andNotExists(select)

@Support
fun Field.or(other: Condition): Condition = condition(this).or(other)

@Support
fun Field.or(other: Field): Condition = condition(this).or(other)

@Support
@PlainSQL
fun Field.or(sql: SQL): Condition = condition(this).or(sql)

@Support
@PlainSQL
fun Field.or(sql: String): Condition = condition(this).or(sql)

@Support
@PlainSQL
fun Field.or(sql: String, vararg bindings: Any): Condition = condition(this).or(sql)

@Support
@PlainSQL
fun Field.or(sql: String, vararg parts: QueryPart): Condition = condition(this).or(sql, parts)

@Support
fun Field.orNot(other: Condition): Condition = condition(this).orNot(other)

@Support
fun Field.orNot(other: Field): Condition = condition(this).orNot(other)

@Support
fun Field.orExists(select: Select<*>): Condition = condition(this).orExists(select)

@Support
fun Field.orNotExists(select: Select<*>): Condition = condition(this).orNotExists(select)

@Support
fun Field.not(): Condition = condition(this).not()


// ----------------------------------------------------------------------------
// Extensions to extract fields from Tables
// ----------------------------------------------------------------------------

@Support
operator fun TableLike<*>.get(index: Int) = this.field(index)

@Support
operator fun TableLike<*>.get(name: Name) = this.field(name)

@Support
operator fun TableLike<*>.get(name: String) = this.field(name)

@Support
operator fun  TableLike<*>.get(field: Field) = this.field(field)

// ----------------------------------------------------------------------------
// Extensions to make Field aware of its being an array
// ----------------------------------------------------------------------------

@Support
operator fun  Field?>.get(index: Int) = arrayGet(this, index)

@Support
operator fun  Field?>.get(index: Field) = arrayGet(this, index)

// ----------------------------------------------------------------------------
// Extensions to make Field and Field aware of its being JSON
// ----------------------------------------------------------------------------

@Support
@JvmName("jsonGetElement")
operator fun Field.get(index: Int) = jsonGetElement(this, index)

@Support
@JvmName("jsonGetElement")
operator fun Field.get(index: Field) = jsonGetElement(this, index)

@Support
@JvmName("jsonGetAttribute")
operator fun Field.get(name: String) = jsonGetAttribute(this, name)

@Support
@JvmName("jsonGetAttribute")
operator fun Field.get(name: Field) = jsonGetAttribute(this, name)

@Support
@JvmName("jsonbGetElement")
operator fun Field.get(index: Int) = jsonbGetElement(this, index)

@Support
@JvmName("jsonbGetElement")
operator fun Field.get(index: Field) = jsonbGetElement(this, index)

@Support
@JvmName("jsonbGetAttribute")
operator fun Field.get(name: String) = jsonbGetAttribute(this, name)

@Support
@JvmName("jsonbGetAttribute")
operator fun Field.get(name: Field) = jsonbGetAttribute(this, name)

// ----------------------------------------------------------------------------
// Extensions to make Select> a scalar subquery of type Field
// ----------------------------------------------------------------------------

@Support
fun  Select>.`as`(alias: String): Field = field(this).`as`(alias)

@Support
fun  Select>.`as`(alias: Name): Field = field(this).`as`(alias)

@Support
fun  Select>.`as`(alias: Field<*>): Field = field(this).`as`(alias)

@Support
fun  Select>.eq(value: T): Condition = field(this).eq(value)

@Support
fun  Select>.eq(value: Field): Condition = field(this).eq(value)

@Support
fun  Select>.equal(value: T): Condition = field(this).equal(value)

@Support
fun  Select>.equal(value: Field): Condition = field(this).equal(value)

@Support
fun  Select>.ne(value: T): Condition = field(this).ne(value)

@Support
fun  Select>.ne(value: Field): Condition = field(this).ne(value)

@Support
fun  Select>.notEqual(value: T): Condition = field(this).notEqual(value)

@Support
fun  Select>.notEqual(value: Field): Condition = field(this).notEqual(value)

@Support
fun  Select>.gt(value: T): Condition = field(this).gt(value)

@Support
fun  Select>.gt(value: Field): Condition = field(this).gt(value)

@Support
fun  Select>.greaterThan(value: T): Condition = field(this).greaterThan(value)

@Support
fun  Select>.greaterThan(value: Field): Condition = field(this).greaterThan(value)

@Support
fun  Select>.ge(value: T): Condition = field(this).ge(value)

@Support
fun  Select>.ge(value: Field): Condition = field(this).ge(value)

@Support
fun  Select>.greaterOrEqual(value: T): Condition = field(this).greaterOrEqual(value)

@Support
fun  Select>.greaterOrEqual(value: Field): Condition =
        field(this).greaterOrEqual(value)

@Support
fun  Select>.lt(value: T): Condition = field(this).lt(value)

@Support
fun  Select>.lt(value: Field): Condition = field(this).lt(value)

@Support
fun  Select>.lessThan(value: T): Condition = field(this).lessThan(value)

@Support
fun  Select>.lessThan(value: Field): Condition = field(this).lessThan(value)

@Support
fun  Select>.le(value: T): Condition = field(this).le(value)

@Support
fun  Select>.le(value: Field): Condition = field(this).le(value)

@Support
fun  Select>.lessOrEqual(value: T): Condition = field(this).lessOrEqual(value)

@Support
fun  Select>.lessOrEqual(value: Field): Condition = field(this).lessOrEqual(value)

@Support
fun  Select>.asc(): SortField = field(this).asc()

@Support
fun  Select>.desc(): SortField = field(this).desc()

@Support
fun  Select>.`in`(values: Collection<*>): Condition = field(this).`in`(values)

@Support
fun  Select>.`in`(values: Result>): Condition = field(this).`in`(values)

@Support
fun  Select>.`in`(vararg values: T): Condition = field(this).`in`(values.asList())

@Support
fun  Select>.`in`(vararg values: Field<*>): Condition = field(this).`in`(values.asList())

@Support
fun  Select>.notIn(values: Collection<*>): Condition = field(this).notIn(values)

@Support
fun  Select>.notIn(values: Result>): Condition = field(this).notIn(values)

@Support
fun  Select>.notIn(vararg values: T): Condition = field(this).notIn(values.asList())

@Support
fun  Select>.notIn(vararg values: Field<*>): Condition = field(this).notIn(values.asList())

// ----------------------------------------------------------------------------
// Extensions to the jOOQ Settings object hierarchy
// ----------------------------------------------------------------------------

fun settings(block: Settings.() -> Unit): Settings {
    val e = Settings()
    block(e)
    return e
}

// [jooq-tools] START [settings]

fun Settings.renderMapping(block: RenderMapping.() -> Unit) {
    if (renderMapping == null)
        renderMapping = RenderMapping()

    block(renderMapping)
}

fun RenderMapping.catalogs(block: MutableList.() -> Unit) {
    block(catalogs)
}

@JvmName("mutableListMappedCatalog")
fun MutableList.catalog(block: MappedCatalog.() -> Unit) {
    val e = MappedCatalog()
    block(e)
    add(e)
}

fun MappedCatalog.schemata(block: MutableList.() -> Unit) {
    block(schemata)
}

@JvmName("mutableListMappedSchema")
fun MutableList.schema(block: MappedSchema.() -> Unit) {
    val e = MappedSchema()
    block(e)
    add(e)
}

fun MappedSchema.tables(block: MutableList.() -> Unit) {
    block(tables)
}

@JvmName("mutableListMappedTable")
fun MutableList.table(block: MappedTable.() -> Unit) {
    val e = MappedTable()
    block(e)
    add(e)
}

fun MappedSchema.udts(block: MutableList.() -> Unit) {
    block(udts)
}

@JvmName("mutableListMappedUDT")
fun MutableList.udt(block: MappedUDT.() -> Unit) {
    val e = MappedUDT()
    block(e)
    add(e)
}

fun RenderMapping.schemata(block: MutableList.() -> Unit) {
    block(schemata)
}

fun Settings.renderFormatting(block: RenderFormatting.() -> Unit) {
    if (renderFormatting == null)
        renderFormatting = RenderFormatting()

    block(renderFormatting)
}

fun Settings.migrationHistorySchema(block: MigrationSchema.() -> Unit) {
    if (migrationHistorySchema == null)
        migrationHistorySchema = MigrationSchema()

    block(migrationHistorySchema)
}

fun Settings.migrationDefaultSchema(block: MigrationSchema.() -> Unit) {
    if (migrationDefaultSchema == null)
        migrationDefaultSchema = MigrationSchema()

    block(migrationDefaultSchema)
}

fun Settings.interpreterSearchPath(block: MutableList.() -> Unit) {
    block(interpreterSearchPath)
}

@JvmName("mutableListInterpreterSearchSchema")
fun MutableList.interpreterSearchPath(block: InterpreterSearchSchema.() -> Unit) {
    val e = InterpreterSearchSchema()
    block(e)
    add(e)
}

fun Settings.migrationSchemata(block: MutableList.() -> Unit) {
    block(migrationSchemata)
}

@JvmName("mutableListMigrationSchema")
fun MutableList.migrationSchemata(block: MigrationSchema.() -> Unit) {
    val e = MigrationSchema()
    block(e)
    add(e)
}

fun Settings.parseSearchPath(block: MutableList.() -> Unit) {
    block(parseSearchPath)
}

@JvmName("mutableListParseSearchSchema")
fun MutableList.parseSearchPath(block: ParseSearchSchema.() -> Unit) {
    val e = ParseSearchSchema()
    block(e)
    add(e)
}

// [jooq-tools] END [settings]

// ----------------------------------------------------------------------------
// Extensions to the jOOQ InformationSchema object hierarchy
// ----------------------------------------------------------------------------

fun informationSchema(block: InformationSchema.() -> Unit): InformationSchema {
    val e = InformationSchema()
    block(e)
    return e
}

// [jooq-tools] START [information-schema]

fun InformationSchema.catalogs(block: MutableList.() -> Unit) {
    block(catalogs)
}

@JvmName("mutableListCatalog")
fun MutableList.catalog(block: org.jooq.util.xml.jaxb.Catalog.() -> Unit) {
    val e = org.jooq.util.xml.jaxb.Catalog()
    block(e)
    add(e)
}

fun InformationSchema.schemata(block: MutableList.() -> Unit) {
    block(schemata)
}

@JvmName("mutableListSchema")
fun MutableList.schema(block: org.jooq.util.xml.jaxb.Schema.() -> Unit) {
    val e = org.jooq.util.xml.jaxb.Schema()
    block(e)
    add(e)
}

fun InformationSchema.sequences(block: MutableList.() -> Unit) {
    block(sequences)
}

@JvmName("mutableListSequence")
fun MutableList.sequence(block: org.jooq.util.xml.jaxb.Sequence.() -> Unit) {
    val e = org.jooq.util.xml.jaxb.Sequence()
    block(e)
    add(e)
}

fun InformationSchema.tables(block: MutableList.() -> Unit) {
    block(tables)
}

@JvmName("mutableListTable")
fun MutableList.table(block: org.jooq.util.xml.jaxb.Table.() -> Unit) {
    val e = org.jooq.util.xml.jaxb.Table()
    block(e)
    add(e)
}

fun InformationSchema.views(block: MutableList.() -> Unit) {
    block(views)
}

@JvmName("mutableListView")
fun MutableList.view(block: View.() -> Unit) {
    val e = View()
    block(e)
    add(e)
}

fun InformationSchema.columns(block: MutableList.() -> Unit) {
    block(columns)
}

@JvmName("mutableListColumn")
fun MutableList.column(block: Column.() -> Unit) {
    val e = Column()
    block(e)
    add(e)
}

fun InformationSchema.tableConstraints(block: MutableList.() -> Unit) {
    block(tableConstraints)
}

@JvmName("mutableListTableConstraint")
fun MutableList.tableConstraint(block: TableConstraint.() -> Unit) {
    val e = TableConstraint()
    block(e)
    add(e)
}

fun InformationSchema.keyColumnUsages(block: MutableList.() -> Unit) {
    block(keyColumnUsages)
}

@JvmName("mutableListKeyColumnUsage")
fun MutableList.keyColumnUsage(block: KeyColumnUsage.() -> Unit) {
    val e = KeyColumnUsage()
    block(e)
    add(e)
}

fun InformationSchema.referentialConstraints(block: MutableList.() -> Unit) {
    block(referentialConstraints)
}

@JvmName("mutableListReferentialConstraint")
fun MutableList.referentialConstraint(block: ReferentialConstraint.() -> Unit) {
    val e = ReferentialConstraint()
    block(e)
    add(e)
}

fun InformationSchema.checkConstraints(block: MutableList.() -> Unit) {
    block(checkConstraints)
}

@JvmName("mutableListCheckConstraint")
fun MutableList.checkConstraint(block: CheckConstraint.() -> Unit) {
    val e = CheckConstraint()
    block(e)
    add(e)
}

fun InformationSchema.domains(block: MutableList.() -> Unit) {
    block(domains)
}

@JvmName("mutableListDomain")
fun MutableList.domain(block: org.jooq.util.xml.jaxb.Domain.() -> Unit) {
    val e = org.jooq.util.xml.jaxb.Domain()
    block(e)
    add(e)
}

fun InformationSchema.domainConstraints(block: MutableList.() -> Unit) {
    block(domainConstraints)
}

@JvmName("mutableListDomainConstraint")
fun MutableList.domainConstraint(block: DomainConstraint.() -> Unit) {
    val e = DomainConstraint()
    block(e)
    add(e)
}

fun InformationSchema.indexes(block: MutableList.() -> Unit) {
    block(indexes)
}

@JvmName("mutableListIndex")
fun MutableList.index(block: org.jooq.util.xml.jaxb.Index.() -> Unit) {
    val e = org.jooq.util.xml.jaxb.Index()
    block(e)
    add(e)
}

fun InformationSchema.indexColumnUsages(block: MutableList.() -> Unit) {
    block(indexColumnUsages)
}

@JvmName("mutableListIndexColumnUsage")
fun MutableList.indexColumnUsage(block: IndexColumnUsage.() -> Unit) {
    val e = IndexColumnUsage()
    block(e)
    add(e)
}

fun InformationSchema.routines(block: MutableList.() -> Unit) {
    block(routines)
}

@JvmName("mutableListRoutine")
fun MutableList.routine(block: org.jooq.util.xml.jaxb.Routine.() -> Unit) {
    val e = org.jooq.util.xml.jaxb.Routine()
    block(e)
    add(e)
}

fun InformationSchema.parameters(block: MutableList.() -> Unit) {
    block(parameters)
}

@JvmName("mutableListParameter")
fun MutableList.parameter(block: org.jooq.util.xml.jaxb.Parameter.() -> Unit) {
    val e = org.jooq.util.xml.jaxb.Parameter()
    block(e)
    add(e)
}

fun InformationSchema.elementTypes(block: MutableList.() -> Unit) {
    block(elementTypes)
}

@JvmName("mutableListElementType")
fun MutableList.elementType(block: ElementType.() -> Unit) {
    val e = ElementType()
    block(e)
    add(e)
}

fun InformationSchema.triggers(block: MutableList.() -> Unit) {
    block(triggers)
}

@JvmName("mutableListTrigger")
fun MutableList.trigger(block: org.jooq.util.xml.jaxb.Trigger.() -> Unit) {
    val e = org.jooq.util.xml.jaxb.Trigger()
    block(e)
    add(e)
}

// [jooq-tools] END [information-schema]

// ----------------------------------------------------------------------------
// Extensions to the jOOQ MigrationType object hierarchy
// ----------------------------------------------------------------------------

fun migrationType(block: MigrationsType.() -> Unit): MigrationsType {
    val e = MigrationsType()
    block(e)
    return e
}

// [jooq-tools] START [migrations-type]

fun MigrationsType.commits(block: MutableList.() -> Unit) {
    block(commits)
}

@JvmName("mutableListCommitType")
fun MutableList.commit(block: CommitType.() -> Unit) {
    val e = CommitType()
    block(e)
    add(e)
}

fun CommitType.parents(block: MutableList.() -> Unit) {
    block(parents)
}

@JvmName("mutableListParentType")
fun MutableList.parent(block: ParentType.() -> Unit) {
    val e = ParentType()
    block(e)
    add(e)
}

fun CommitType.tags(block: MutableList.() -> Unit) {
    block(tags)
}

@JvmName("mutableListTagType")
fun MutableList.tag(block: TagType.() -> Unit) {
    val e = TagType()
    block(e)
    add(e)
}

fun CommitType.files(block: MutableList.() -> Unit) {
    block(files)
}

@JvmName("mutableListFileType")
fun MutableList.file(block: FileType.() -> Unit) {
    val e = FileType()
    block(e)
    add(e)
}

// [jooq-tools] END [migrations-type]




© 2015 - 2024 Weber Informatics LLC | Privacy Policy