Emails.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.EmailsRecord;

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

import org.jooq.Check;
import org.jooq.Field;
import org.jooq.ForeignKey;
import org.jooq.Function3;
import org.jooq.Name;
import org.jooq.Record;
import org.jooq.Records;
import org.jooq.Row3;
import org.jooq.Schema;
import org.jooq.SelectField;
import org.jooq.Table;
import org.jooq.TableField;
import org.jooq.TableOptions;
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.
 */
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class Emails extends TableImpl<EmailsRecord> {

    private static final long serialVersionUID = 1L;

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

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

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

    /**
     * The column <code>EMAILS.ADMIN_ID</code>.
     */
    public final TableField<EmailsRecord, UUID> ADMIN_ID = createField(DSL.name("ADMIN_ID"), SQLDataType.UUID, this, "");

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

    private Emails(Name alias, Table<EmailsRecord> aliased) {
        this(alias, aliased, null);
    }

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

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

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

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

    public <O extends Record> Emails(Table<O> child, ForeignKey<O, EmailsRecord> key) {
        super(child, key, EMAILS);
    }

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

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

    private transient Users _users;
    private transient Admins _admins;

    /**
     * Get the implicit join path to the <code>PUBLIC.USERS</code> table.
     */
    public Users users() {
        if (_users == null)
            _users = new Users(this, Keys.CONSTRAINT_7A);

        return _users;
    }

    /**
     * Get the implicit join path to the <code>PUBLIC.ADMINS</code> table.
     */
    public Admins admins() {
        if (_admins == null)
            _admins = new Admins(this, Keys.CONSTRAINT_7A1);

        return _admins;
    }

    @Override
    public List<Check<EmailsRecord>> getChecks() {
        return Arrays.asList(
            Internal.createCheck(this, DSL.name("CHECK_USER_OR_ADMIN"), "(\"USER_ID\" IS NOT NULL)\n    OR (\"ADMIN_ID\" IS NOT NULL)", true)
        );
    }

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

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

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

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

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

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

    // -------------------------------------------------------------------------
    // Row3 type methods
    // -------------------------------------------------------------------------

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

    /**
     * Convenience mapping calling {@link SelectField#convertFrom(Function)}.
     */
    public <U> SelectField<U> mapping(Function3<? super UUID, ? super UUID, ? 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, Function3<? super UUID, ? super UUID, ? super String, ? extends U> from) {
        return convertFrom(toType, Records.mapping(from));
    }
}