LoginHistory.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.LoginHistoryRecord;

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.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.impl.DSL;
import org.jooq.impl.SQLDataType;
import org.jooq.impl.TableImpl;


/**
 * This class is generated by jOOQ.
 */
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class LoginHistory extends TableImpl<LoginHistoryRecord> {

    private static final long serialVersionUID = 1L;

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

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

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

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

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

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

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

    private LoginHistory(Name alias, Table<LoginHistoryRecord> aliased) {
        this(alias, aliased, null);
    }

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

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

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

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

    public <O extends Record> LoginHistory(Table<O> child, ForeignKey<O, LoginHistoryRecord> key) {
        super(child, key, LOGIN_HISTORY);
    }

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

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

    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_3E);

        return _userIds;
    }

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

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

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

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

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

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

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

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

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