/*
 * This file is generated by jOOQ.
 */
package cn.vertxup.atom.domain.tables;


import cn.vertxup.atom.domain.Db;
import cn.vertxup.atom.domain.Indexes;
import cn.vertxup.atom.domain.Keys;
import cn.vertxup.atom.domain.tables.records.MFieldRecord;
import org.jooq.Record;
import org.jooq.*;
import org.jooq.impl.DSL;
import org.jooq.impl.SQLDataType;
import org.jooq.impl.TableImpl;

import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.List;
import java.util.function.Function;


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

    /**
     * The reference instance of <code>DB_ETERNAL.M_FIELD</code>
     */
    public static final MField M_FIELD = new MField();
    private static final long serialVersionUID = 1L;
    /**
     * The column <code>DB_ETERNAL.M_FIELD.KEY</code>. 「key」- 字段ID
     */
    public final TableField<MFieldRecord, String> KEY = createField(DSL.name("KEY"), SQLDataType.VARCHAR(36).nullable(false), this, "「key」- 字段ID");
    /**
     * The column <code>DB_ETERNAL.M_FIELD.NAME</code>. 「name」- 属性名（非列）
     */
    public final TableField<MFieldRecord, String> NAME = createField(DSL.name("NAME"), SQLDataType.VARCHAR(255), this, "「name」- 属性名（非列）");
    /**
     * The column <code>DB_ETERNAL.M_FIELD.TYPE</code>. 「type」- OX核心类型
     */
    public final TableField<MFieldRecord, String> TYPE = createField(DSL.name("TYPE"), SQLDataType.VARCHAR(64), this, "「type」- OX核心类型");
    /**
     * The column <code>DB_ETERNAL.M_FIELD.COLUMN_NAME</code>. 「columnName」-
     * 数据库列名
     */
    public final TableField<MFieldRecord, String> COLUMN_NAME = createField(DSL.name("COLUMN_NAME"), SQLDataType.VARCHAR(255), this, "「columnName」- 数据库列名");
    /**
     * The column <code>DB_ETERNAL.M_FIELD.COLUMN_TYPE</code>. 「columnType」-
     * 数据库转换过后的类型
     */
    public final TableField<MFieldRecord, String> COLUMN_TYPE = createField(DSL.name("COLUMN_TYPE"), SQLDataType.VARCHAR(255), this, "「columnType」- 数据库转换过后的类型");
    /**
     * The column <code>DB_ETERNAL.M_FIELD.IS_PRIMARY</code>. 「isPrimary」- 是否为主键
     */
    public final TableField<MFieldRecord, Boolean> IS_PRIMARY = createField(DSL.name("IS_PRIMARY"), SQLDataType.BIT, this, "「isPrimary」- 是否为主键");
    /**
     * The column <code>DB_ETERNAL.M_FIELD.IS_NULLABLE</code>. 「isNullable」-
     * 是否可为空
     */
    public final TableField<MFieldRecord, Boolean> IS_NULLABLE = createField(DSL.name("IS_NULLABLE"), SQLDataType.BIT, this, "「isNullable」- 是否可为空");
    /**
     * The column <code>DB_ETERNAL.M_FIELD.LENGTH</code>. 「length」- String类型的长度
     */
    public final TableField<MFieldRecord, Integer> LENGTH = createField(DSL.name("LENGTH"), SQLDataType.INTEGER, this, "「length」- String类型的长度");
    /**
     * The column <code>DB_ETERNAL.M_FIELD.PRECISION</code>. 「precision」-
     * Decimal类型的精度
     */
    public final TableField<MFieldRecord, Integer> PRECISION = createField(DSL.name("PRECISION"), SQLDataType.INTEGER, this, "「precision」- Decimal类型的精度");
    /**
     * The column <code>DB_ETERNAL.M_FIELD.FORMAT</code>. 「format」-
     * 当前数据列的格式，String或Date类型
     */
    public final TableField<MFieldRecord, String> FORMAT = createField(DSL.name("FORMAT"), SQLDataType.VARCHAR(255), this, "「format」- 当前数据列的格式，String或Date类型");
    /**
     * The column <code>DB_ETERNAL.M_FIELD.IN_COMPONENT</code>. 「inComponent」-
     * 写入插件
     */
    public final TableField<MFieldRecord, String> IN_COMPONENT = createField(DSL.name("IN_COMPONENT"), SQLDataType.VARCHAR(255), this, "「inComponent」- 写入插件");
    /**
     * The column <code>DB_ETERNAL.M_FIELD.OUT_COMPONENT</code>. 「outComponent」-
     * 读取插件
     */
    public final TableField<MFieldRecord, String> OUT_COMPONENT = createField(DSL.name("OUT_COMPONENT"), SQLDataType.VARCHAR(255), this, "「outComponent」- 读取插件");
    /**
     * The column <code>DB_ETERNAL.M_FIELD.ENTITY_ID</code>. 「entityId」- 关联的实体ID
     */
    public final TableField<MFieldRecord, String> ENTITY_ID = createField(DSL.name("ENTITY_ID"), SQLDataType.VARCHAR(36), this, "「entityId」- 关联的实体ID");
    /**
     * The column <code>DB_ETERNAL.M_FIELD.COMMENTS</code>. 「comments」-
     * 当前属性的描述信息
     */
    public final TableField<MFieldRecord, String> COMMENTS = createField(DSL.name("COMMENTS"), SQLDataType.CLOB, this, "「comments」- 当前属性的描述信息");
    /**
     * The column <code>DB_ETERNAL.M_FIELD.SIGMA</code>. 「sigma」- 统一标识
     */
    public final TableField<MFieldRecord, String> SIGMA = createField(DSL.name("SIGMA"), SQLDataType.VARCHAR(32), this, "「sigma」- 统一标识");
    /**
     * The column <code>DB_ETERNAL.M_FIELD.LANGUAGE</code>. 「language」- 使用的语言
     */
    public final TableField<MFieldRecord, String> LANGUAGE = createField(DSL.name("LANGUAGE"), SQLDataType.VARCHAR(10), this, "「language」- 使用的语言");
    /**
     * The column <code>DB_ETERNAL.M_FIELD.ACTIVE</code>. 「active」- 是否启用
     */
    public final TableField<MFieldRecord, Boolean> ACTIVE = createField(DSL.name("ACTIVE"), SQLDataType.BIT, this, "「active」- 是否启用");
    /**
     * The column <code>DB_ETERNAL.M_FIELD.METADATA</code>. 「metadata」- 附加配置数据
     */
    public final TableField<MFieldRecord, String> METADATA = createField(DSL.name("METADATA"), SQLDataType.CLOB, this, "「metadata」- 附加配置数据");
    /**
     * The column <code>DB_ETERNAL.M_FIELD.CREATED_AT</code>. 「createdAt」- 创建时间
     */
    public final TableField<MFieldRecord, LocalDateTime> CREATED_AT = createField(DSL.name("CREATED_AT"), SQLDataType.LOCALDATETIME(0), this, "「createdAt」- 创建时间");
    /**
     * The column <code>DB_ETERNAL.M_FIELD.CREATED_BY</code>. 「createdBy」- 创建人
     */
    public final TableField<MFieldRecord, String> CREATED_BY = createField(DSL.name("CREATED_BY"), SQLDataType.VARCHAR(36), this, "「createdBy」- 创建人");
    /**
     * The column <code>DB_ETERNAL.M_FIELD.UPDATED_AT</code>. 「updatedAt」- 更新时间
     */
    public final TableField<MFieldRecord, LocalDateTime> UPDATED_AT = createField(DSL.name("UPDATED_AT"), SQLDataType.LOCALDATETIME(0), this, "「updatedAt」- 更新时间");
    /**
     * The column <code>DB_ETERNAL.M_FIELD.UPDATED_BY</code>. 「updatedBy」- 更新人
     */
    public final TableField<MFieldRecord, String> UPDATED_BY = createField(DSL.name("UPDATED_BY"), SQLDataType.VARCHAR(36), this, "「updatedBy」- 更新人");

    private MField(Name alias, Table<MFieldRecord> aliased) {
        this(alias, aliased, null);
    }

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

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

    /**
     * Create an aliased <code>DB_ETERNAL.M_FIELD</code> table reference
     */
    public MField(Name alias) {
        this(alias, M_FIELD);
    }

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

    public <O extends Record> MField(Table<O> child, ForeignKey<O, MFieldRecord> key) {
        super(child, key, M_FIELD);
    }

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

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

    @Override
    public List<Index> getIndexes() {
        return Arrays.asList(Indexes.M_FIELD_IDX_M_FIELD_ENTITY_ID);
    }

    @Override
    public UniqueKey<MFieldRecord> getPrimaryKey() {
        return Keys.KEY_M_FIELD_PRIMARY;
    }

    @Override
    public List<UniqueKey<MFieldRecord>> getUniqueKeys() {
        return Arrays.asList(Keys.KEY_M_FIELD_NAME);
    }

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

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

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

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

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

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

    // -------------------------------------------------------------------------
    // Row22 type methods
    // -------------------------------------------------------------------------

    @Override
    public Row22<String, String, String, String, String, Boolean, Boolean, Integer, Integer, String, String, String, String, String, String, String, Boolean, String, LocalDateTime, String, LocalDateTime, String> fieldsRow() {
        return (Row22) super.fieldsRow();
    }

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