/*
 * This file is generated by jOOQ.
 */
package ervu_secret.ervu_secret.db_beans.pg_catalog.tables;


import ervu_secret.ervu_secret.db_beans.pg_catalog.PgCatalog;
import ervu_secret.ervu_secret.db_beans.pg_catalog.tables.records.PgLocksRecord;

import java.sql.Timestamp;
import java.util.Collection;

import org.jooq.Condition;
import org.jooq.Field;
import org.jooq.Name;
import org.jooq.PlainSQL;
import org.jooq.QueryPart;
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.impl.DSL;
import org.jooq.impl.SQLDataType;
import org.jooq.impl.TableImpl;


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

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of <code>pg_catalog.pg_locks</code>
     */
    public static final PgLocks PG_LOCKS = new PgLocks();

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

    /**
     * The column <code>pg_catalog.pg_locks.locktype</code>.
     */
    public final TableField<PgLocksRecord, String> LOCKTYPE = createField(DSL.name("locktype"), SQLDataType.CLOB, this, "");

    /**
     * The column <code>pg_catalog.pg_locks.database</code>.
     */
    public final TableField<PgLocksRecord, Long> DATABASE = createField(DSL.name("database"), SQLDataType.BIGINT, this, "");

    /**
     * The column <code>pg_catalog.pg_locks.relation</code>.
     */
    public final TableField<PgLocksRecord, Long> RELATION = createField(DSL.name("relation"), SQLDataType.BIGINT, this, "");

    /**
     * The column <code>pg_catalog.pg_locks.page</code>.
     */
    public final TableField<PgLocksRecord, Integer> PAGE = createField(DSL.name("page"), SQLDataType.INTEGER, this, "");

    /**
     * The column <code>pg_catalog.pg_locks.tuple</code>.
     */
    public final TableField<PgLocksRecord, Short> TUPLE = createField(DSL.name("tuple"), SQLDataType.SMALLINT, this, "");

    /**
     * The column <code>pg_catalog.pg_locks.virtualxid</code>.
     */
    public final TableField<PgLocksRecord, String> VIRTUALXID = createField(DSL.name("virtualxid"), SQLDataType.CLOB, this, "");

    /**
     * The column <code>pg_catalog.pg_locks.transactionid</code>.
     */
    public final TableField<PgLocksRecord, Long> TRANSACTIONID = createField(DSL.name("transactionid"), SQLDataType.BIGINT, this, "");

    /**
     * The column <code>pg_catalog.pg_locks.classid</code>.
     */
    public final TableField<PgLocksRecord, Long> CLASSID = createField(DSL.name("classid"), SQLDataType.BIGINT, this, "");

    /**
     * The column <code>pg_catalog.pg_locks.objid</code>.
     */
    public final TableField<PgLocksRecord, Long> OBJID = createField(DSL.name("objid"), SQLDataType.BIGINT, this, "");

    /**
     * The column <code>pg_catalog.pg_locks.objsubid</code>.
     */
    public final TableField<PgLocksRecord, Short> OBJSUBID = createField(DSL.name("objsubid"), SQLDataType.SMALLINT, this, "");

    /**
     * The column <code>pg_catalog.pg_locks.virtualtransaction</code>.
     */
    public final TableField<PgLocksRecord, String> VIRTUALTRANSACTION = createField(DSL.name("virtualtransaction"), SQLDataType.CLOB, this, "");

    /**
     * The column <code>pg_catalog.pg_locks.pid</code>.
     */
    public final TableField<PgLocksRecord, Integer> PID = createField(DSL.name("pid"), SQLDataType.INTEGER, this, "");

    /**
     * The column <code>pg_catalog.pg_locks.mode</code>.
     */
    public final TableField<PgLocksRecord, String> MODE = createField(DSL.name("mode"), SQLDataType.CLOB, this, "");

    /**
     * The column <code>pg_catalog.pg_locks.granted</code>.
     */
    public final TableField<PgLocksRecord, Boolean> GRANTED = createField(DSL.name("granted"), SQLDataType.BOOLEAN, this, "");

    /**
     * The column <code>pg_catalog.pg_locks.fastpath</code>.
     */
    public final TableField<PgLocksRecord, Boolean> FASTPATH = createField(DSL.name("fastpath"), SQLDataType.BOOLEAN, this, "");

    /**
     * The column <code>pg_catalog.pg_locks.waitstart</code>.
     */
    public final TableField<PgLocksRecord, Timestamp> WAITSTART = createField(DSL.name("waitstart"), SQLDataType.TIMESTAMP(0), this, "");

    private PgLocks(Name alias, Table<PgLocksRecord> aliased) {
        this(alias, aliased, (Field<?>[]) null, null);
    }

    private PgLocks(Name alias, Table<PgLocksRecord> aliased, Field<?>[] parameters, Condition where) {
        super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.view("""
        create view "pg_locks" as  SELECT l.locktype,
         l.database,
         l.relation,
         l.page,
         l.tuple,
         l.virtualxid,
         l.transactionid,
         l.classid,
         l.objid,
         l.objsubid,
         l.virtualtransaction,
         l.pid,
         l.mode,
         l.granted,
         l.fastpath,
         l.waitstart
        FROM pg_lock_status() l(locktype, database, relation, page, tuple, virtualxid, transactionid, classid, objid, objsubid, virtualtransaction, pid, mode, granted, fastpath, waitstart);
        """), where);
    }

    /**
     * Create an aliased <code>pg_catalog.pg_locks</code> table reference
     */
    public PgLocks(String alias) {
        this(DSL.name(alias), PG_LOCKS);
    }

    /**
     * Create an aliased <code>pg_catalog.pg_locks</code> table reference
     */
    public PgLocks(Name alias) {
        this(alias, PG_LOCKS);
    }

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

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

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

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

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

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

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

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

    /**
     * Create an inline derived table from this table
     */
    @Override
    public PgLocks where(Condition condition) {
        return new PgLocks(getQualifiedName(), aliased() ? this : null, null, condition);
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    public PgLocks where(Collection<? extends Condition> conditions) {
        return where(DSL.and(conditions));
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    public PgLocks where(Condition... conditions) {
        return where(DSL.and(conditions));
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    public PgLocks where(Field<Boolean> condition) {
        return where(DSL.condition(condition));
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    @PlainSQL
    public PgLocks where(SQL condition) {
        return where(DSL.condition(condition));
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    @PlainSQL
    public PgLocks where(@Stringly.SQL String condition) {
        return where(DSL.condition(condition));
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    @PlainSQL
    public PgLocks where(@Stringly.SQL String condition, Object... binds) {
        return where(DSL.condition(condition, binds));
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    @PlainSQL
    public PgLocks where(@Stringly.SQL String condition, QueryPart... parts) {
        return where(DSL.condition(condition, parts));
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    public PgLocks whereExists(Select<?> select) {
        return where(DSL.exists(select));
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    public PgLocks whereNotExists(Select<?> select) {
        return where(DSL.notExists(select));
    }
}
