Record Class ColumnDef

java.lang.Object
java.lang.Record
org.huiche.ddl.definition.ColumnDef
Record Components:
name - 列名
type - 数据库类型
length - 长度,默认-1
scale - 精度,默认-1
primaryKey - 是否主键
unique - 是否唯一
nullable - 是否允许空
autoIncrement - 是否自增
comment - 列注释,没有时为null
defaultValue - 默认值,没有时为null
definition - 列完整定义,没有时为null
All Implemented Interfaces:
Serializable, Segment

public record ColumnDef(String name, String type, int length, int scale, boolean primaryKey, boolean unique, boolean nullable, boolean autoIncrement, String comment, String defaultValue, String definition) extends Record implements Segment
列定义
Author:
Maning
See Also:
  • Constructor Details

    • ColumnDef

      public ColumnDef(String name, String type, int length, int scale, boolean primaryKey, boolean unique, boolean nullable, boolean autoIncrement, String comment, String defaultValue, String definition)
      Creates an instance of a ColumnDef record class.
      Parameters:
      name - the value for the name record component
      type - the value for the type record component
      length - the value for the length record component
      scale - the value for the scale record component
      primaryKey - the value for the primaryKey record component
      unique - the value for the unique record component
      nullable - the value for the nullable record component
      autoIncrement - the value for the autoIncrement record component
      comment - the value for the comment record component
      defaultValue - the value for the defaultValue record component
      definition - the value for the definition record component
  • Method Details

    • pseudoSql

      public String pseudoSql()
      Description copied from interface: Segment
      伪SQL,用于直接toString时显示
      Specified by:
      pseudoSql in interface Segment
      Returns:
      伪SQL
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • type

      public String type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • length

      public int length()
      Returns the value of the length record component.
      Returns:
      the value of the length record component
    • scale

      public int scale()
      Returns the value of the scale record component.
      Returns:
      the value of the scale record component
    • primaryKey

      public boolean primaryKey()
      Returns the value of the primaryKey record component.
      Returns:
      the value of the primaryKey record component
    • unique

      public boolean unique()
      Returns the value of the unique record component.
      Returns:
      the value of the unique record component
    • nullable

      public boolean nullable()
      Returns the value of the nullable record component.
      Returns:
      the value of the nullable record component
    • autoIncrement

      public boolean autoIncrement()
      Returns the value of the autoIncrement record component.
      Returns:
      the value of the autoIncrement record component
    • comment

      public String comment()
      Returns the value of the comment record component.
      Returns:
      the value of the comment record component
    • defaultValue

      public String defaultValue()
      Returns the value of the defaultValue record component.
      Returns:
      the value of the defaultValue record component
    • definition

      public String definition()
      Returns the value of the definition record component.
      Returns:
      the value of the definition record component