class Amber::CLI::Field
Defined in:
amber_cli/generators/field.cr
Constant Summary
-
TYPE_MAPPING =
{common: {string: ["string", "String", "VARCHAR"], text: ["text", "String", "TEXT"], int: ["integer", "Int32", "INT"], int32: ["integer", "Int32", "INT"], integer: ["integer", "Int32", "INT"], int64: ["bigint", "Int64", "BIGINT"], bigint: ["bigint", "Int64", "BIGINT"], float: ["float", "Float64", "FLOAT"], float64: ["real", "Float64", "FLOAT"], real: ["real", "Float64", "REAL"], bool: ["boolean", "Bool", "BOOL"], boolean: ["boolean", "Bool", "BOOL"], date: ["date", "Time", "DATE"], time: ["time", "Time", "TIMESTAMP"], timestamp: ["time", "Time", "TIMESTAMP"], password: ["password", "String", "VARCHAR"], ref: ["reference", "Int64", "BIGINT"], belongs_to: ["reference", "Int64", "BIGINT"], reference: ["reference", "Int64", "BIGINT"], references: ["reference", "Int64", "BIGINT"]}, mysql: {string: ["string", "String", "VARCHAR(255)"], float: ["float", "Float32", "FLOAT"], password: ["password", "String", "VARCHAR(255)"], time: ["time", "Time", "TIMESTAMP NULL"], timestamp: ["time", "Time", "TIMESTAMP NULL"]}, sqlite: {int: ["bigint", "Int64", "INT"], int32: ["bigint", "Int64", "INT"], integer: ["bigint", "Int64", "INT"], int64: ["bigint", "Int64", "INT"], bigint: ["bigint", "Int64", "INT"], bool: ["boolean", "Int64", "BOOL"], boolean: ["boolean", "Int64", "BOOL"], date: ["date_as_var", "String", "DATE"], time: ["time_as_var", "String", "TIMESTAMP"], timestamp: ["time_as_var", "String", "TIMESTAMP"]}}
Constructors
Instance Method Summary
Constructor Detail
def self.
new(field, hidden : Bool =
false, database : String =
"pg")
#
Instance Method Detail
def
cr_type=(cr_type : String)
#
def
database=(database : String)
#
def
db_type=(db_type : String)
#
def
hidden=(hidden : Bool)
#
def
name=(name : String)
#
def
to_json(json : JSON::Builder)
#
def
type=(type : String)
#
def
type_mapping(type =
"string")
#