def primary_key : String?
#
class Miner::Table
- Miner::Table
- Reference
- Object
Defined in:
miner/table.crConstructors
-
.new(name : String, analias : String | Nil = nil, database : Miner::Database = Miner.default_database)
Create the table object
Instance Method Summary
- #alias : String
- #alias=(alias __arg0 : String)
- #field(name : String) : Field | Nil
- #fields : Hash(String, Miner::Field)?
- #has_field?(name : String) : Bool
- #has_relationship?(name : String) : Bool
- #name : String
- #primary_key : String?
- #relationship(name : String) : Relationship | Nil
- #relationships : Hash(String, Miner::Relationship)?
Constructor Detail
def self.new(name : String, analias : String | Nil = nil, database : Miner::Database = Miner.default_database)
#
Create the table object
At it's simplest, a table can be initialized with just a table name
table = Miner::Table.new "countries"
You can specify an alias to refer to the table when it is used within a query
table = Miner::table.new "countries", "the_countries_table"
You can specify a database other than the default by passing it as the third argument
table = Miner::Table.new "countries", nil, Miner::Database.new(config)