Audit.java

/*
 * This file is generated by jOOQ.
 */
package com.io7m.idstore.database.postgres.internal.tables;


import com.io7m.idstore.database.postgres.internal.DefaultSchema;
import com.io7m.idstore.database.postgres.internal.Keys;
import com.io7m.idstore.database.postgres.internal.tables.records.AuditRecord;

import java.time.OffsetDateTime;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
import java.util.function.Function;

import org.jooq.Field;
import org.jooq.ForeignKey;
import org.jooq.Function5;
import org.jooq.Identity;
import org.jooq.Name;
import org.jooq.Record;
import org.jooq.Records;
import org.jooq.Row5;
import org.jooq.Schema;
import org.jooq.SelectField;
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.
 */
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class Audit extends TableImpl<AuditRecord> {

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of <code>AUDIT</code>
     */
    public static final Audit AUDIT = new Audit();

    /**
     * The class holding records for this type
     */
    @Override
    public Class<AuditRecord> getRecordType() {
        return AuditRecord.class;
    }

    /**
     * The column <code>AUDIT.ID</code>.
     */
    public final TableField<AuditRecord, Long> ID = createField(DSL.name("ID"), SQLDataType.BIGINT.nullable(false).identity(true), this, "");

    /**
     * The column <code>AUDIT.USER_ID</code>.
     */
    public final TableField<AuditRecord, UUID> USER_ID = createField(DSL.name("USER_ID"), SQLDataType.UUID.nullable(false), this, "");

    /**
     * The column <code>AUDIT.TIME</code>.
     */
    public final TableField<AuditRecord, OffsetDateTime> TIME = createField(DSL.name("TIME"), SQLDataType.TIMESTAMPWITHTIMEZONE(6).nullable(false), this, "");

    /**
     * The column <code>AUDIT.TYPE</code>.
     */
    public final TableField<AuditRecord, String> TYPE = createField(DSL.name("TYPE"), SQLDataType.VARCHAR(1000000).nullable(false), this, "");

    /**
     * The column <code>AUDIT.MESSAGE</code>.
     */
    public final TableField<AuditRecord, String> MESSAGE = createField(DSL.name("MESSAGE"), SQLDataType.VARCHAR(1000000).nullable(false), this, "");

    private Audit(Name alias, Table<AuditRecord> aliased) {
        this(alias, aliased, null);
    }

    private Audit(Name alias, Table<AuditRecord> aliased, Field<?>[] parameters) {
        super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.table());
    }

    /**
     * Create an aliased <code>AUDIT</code> table reference
     */
    public Audit(String alias) {
        this(DSL.name(alias), AUDIT);
    }

    /**
     * Create an aliased <code>AUDIT</code> table reference
     */
    public Audit(Name alias) {
        this(alias, AUDIT);
    }

    /**
     * Create a <code>AUDIT</code> table reference
     */
    public Audit() {
        this(DSL.name("AUDIT"), null);
    }

    public <O extends Record> Audit(Table<O> child, ForeignKey<O, AuditRecord> key) {
        super(child, key, AUDIT);
    }

    @Override
    public Schema getSchema() {
        return aliased() ? null : DefaultSchema.DEFAULT_SCHEMA;
    }

    @Override
    public Identity<AuditRecord, Long> getIdentity() {
        return (Identity<AuditRecord, Long>) super.getIdentity();
    }

    @Override
    public UniqueKey<AuditRecord> getPrimaryKey() {
        return Keys.CONSTRAINT_3;
    }

    @Override
    public List<ForeignKey<AuditRecord, ?>> getReferences() {
        return Arrays.asList(Keys.CONSTRAINT_3B);
    }

    private transient UserIds _userIds;

    /**
     * Get the implicit join path to the <code>PUBLIC.USER_IDS</code> table.
     */
    public UserIds userIds() {
        if (_userIds == null)
            _userIds = new UserIds(this, Keys.CONSTRAINT_3B);

        return _userIds;
    }

    @Override
    public Audit as(String alias) {
        return new Audit(DSL.name(alias), this);
    }

    @Override
    public Audit as(Name alias) {
        return new Audit(alias, this);
    }

    @Override
    public Audit as(Table<?> alias) {
        return new Audit(alias.getQualifiedName(), this);
    }

    /**
     * Rename this table
     */
    @Override
    public Audit rename(String name) {
        return new Audit(DSL.name(name), null);
    }

    /**
     * Rename this table
     */
    @Override
    public Audit rename(Name name) {
        return new Audit(name, null);
    }

    /**
     * Rename this table
     */
    @Override
    public Audit rename(Table<?> name) {
        return new Audit(name.getQualifiedName(), null);
    }

    // -------------------------------------------------------------------------
    // Row5 type methods
    // -------------------------------------------------------------------------

    @Override
    public Row5<Long, UUID, OffsetDateTime, String, String> fieldsRow() {
        return (Row5) super.fieldsRow();
    }

    /**
     * Convenience mapping calling {@link SelectField#convertFrom(Function)}.
     */
    public <U> SelectField<U> mapping(Function5<? super Long, ? super UUID, ? super OffsetDateTime, ? super String, ? super String, ? extends U> from) {
        return convertFrom(Records.mapping(from));
    }

    /**
     * Convenience mapping calling {@link SelectField#convertFrom(Class,
     * Function)}.
     */
    public <U> SelectField<U> mapping(Class<U> toType, Function5<? super Long, ? super UUID, ? super OffsetDateTime, ? super String, ? super String, ? extends U> from) {
        return convertFrom(toType, Records.mapping(from));
    }
}