class
CQL::DateColumn(Type)
- CQL::DateColumn(Type)
- CQL::Column(Type)
- CQL::BaseColumn
- Reference
- Object
Overview
A date-only column (Table#date). CQL::Date is Time, so the type alone cannot tell it from
a timestamp; this column declares itself DATE on every adapter. AlterTable#add_column and
change_column take a Crystal type, so Date there declares a timestamp.
Defined in:
column.crConstructors
-
.new(name : Symbol, as_name : String | Nil = nil, null : Bool = false, default : DB::Any = nil, unique : Bool = false, size : Int32 | Nil = nil, index : Index | Nil = nil, version_number : Bool = false)
Create a new column instance; the type is the class's type argument (
Column(String)).
Instance Method Summary
-
#copy_to(table : Table) : BaseColumn
A copy of this column owned by table (used for CTEs and derived tables).
- #type
Instance methods inherited from class CQL::Column(Type)
copy_to(table : Table) : BaseColumn
copy_to,
expression(table_alias : String | Nil) : Expression::BaseColumnexpression : Expression::BaseColumn expression, size : Int32 | Nil size, strict_type strict_type, type type
Constructor methods inherited from class CQL::Column(Type)
new(name : Symbol, as_name : String | Nil = nil, null : Bool = false, default : DB::Any = nil, unique : Bool = false, size : Int32 | Nil = nil, index : Index | Nil = nil, version_number : Bool = false)
new
Instance methods inherited from class CQL::BaseColumn
copy_to(table : Table) : BaseColumn
copy_to
Constructor Detail
def self.new(name : Symbol, as_name : String | Nil = nil, null : Bool = false, default : DB::Any = nil, unique : Bool = false, size : Int32 | Nil = nil, index : Index | Nil = nil, version_number : Bool = false)
#
Create a new column instance; the type is the class's type argument (Column(String)).
Tables add columns with Table#column instead.
- @param : name (Symbol) - The name of the column
- @param : as_name (String, nil) - An optional alias for the column
- @param : null (Bool) - Whether the column allows null values (default: false)
- @param : default (DB::Any) - The default value for the column (default: nil)
- @param : unique (Bool) - Whether the column should have a unique constraint (default: false)
- @param : size (Int32, nil) - The size of the column (default: nil)
- @param : index (Index, nil) - The index for the column (default: nil)
- @param : version_number (Bool) - Whether this column is used for optimistic locking (default: false)
Example
column = CQL::Column(String).new(:name)
Instance Method Detail
Description copied from class CQL::Column(Type)
A copy of this column owned by table (used for CTEs and derived tables).