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"], uuid: ["uuid", "UUID", "binary(16)"]}, 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
hidden=(hidden : Bool)
#
def
to_json(json : JSON::Builder)
#
def
type_mapping(type =
"string")
#