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") #

[View source]

Instance Method Detail

def class_name #

[View source]
def cr_type : String #

[View source]
def cr_type=(cr_type : String) #

[View source]
def database : String #

[View source]
def database=(database : String) #

[View source]
def db_type : String #

[View source]
def db_type=(db_type : String) #

[View source]
def hidden : Bool #

[View source]
def hidden=(hidden : Bool) #

[View source]
def name : String #

[View source]
def name=(name : String) #

[View source]
def reference? #

[View source]
def to_json(json : JSON::Builder) #

[View source]
def type : String #

[View source]
def type=(type : String) #

[View source]
def type_mapping(type = "string") #

[View source]