Skip to content

Latest commit

 

History

History
99 lines (87 loc) · 2.63 KB

API.rdoc

File metadata and controls

99 lines (87 loc) · 2.63 KB

Swift

Public API

Public API minus the optional stuff like Pool, IdentityMap, Migrations etc.

Swift
  .setup  #=> Adapter
  .db     #=> Adapter
  .schema #=> [Record, ...]
  .trace

  # Abstract.
  Adapter
    .new           #=> Adapter
    #create        #=> Record or Result
    #delete        #=> Result
    #execute       #=> Result
    #get           #=> Record
    #prepare       #=> Statement
    #update        #=> Record or Result

  # Adapter::Sql
    #begin
    #commit
    #rollback
    #transaction   #=> Adapter
    #ping          #=> true or false
    #close         #=> true or false
    #closed?       #=> true or false
    #escape        #=> String
    #query
    #fileno        #=> Integer
    #result        #=> Result
    #write         #=> Result

  # Concrete.
  DB
    Mysql    < Adapter::Sql
    Postgres < Adapter::Sql
    Sqlite3  < Adapter::Sql

  # Enumerable collection of Record or Hash tuples.
  Result
    .new           #=> Result
    #insert_id     #=> Numeric
    #fields        #=> [Symbol, ...] # Field names identical to .first.keys if rows > 0
    #types         #=> [String, ...] # Type names: boolean, integer, float, numeric, timestamp, date, time, blob, text
    #selected_rows #=> Fixnum
    #affected_rows #=> Fixnum

  Statement
    .new     #=> Statement
    #execute #=> Result

  Record
    .attribute #=> Type
    .create    #=> Record or Result
    .get       #=> Record
    .header    #=> Header
    .load      #=> Record
    .new       #=> Record
    .store     #=> Symbol
    #execute   #=> Result
    #prepare   #=> Statement
    #record    #=> Alias for self.class
    #tuple     #=> Hash
    #update    #=> Record or Result

  # Enumerable collection of Types for Record.
  Header
    .new        #=> Header
    #all        #=> [Type, ...]
    #insertable #=> [Type, ...]
    #keys       #=> [Symbol, ...]
    #new_tuple  #=> Hash
    #push       #=> Type
    #serial     #=> Symbol or nil.
    #updatable  #=> [Type, ...]

  # Abstract.
  Attribute
    .new                   #=> Attribute
    #name                  #=> Symbol
    #field                 #=> Symbol
    #key                   #=> true or false
    #serial                #=> Symbol or nil
    #default               #=> Object
    #define_record_methods

  # Concrete.
  Type
    BigDecimal < Attribute
    Boolean    < Attribute
    Float      < Attribute
    Integer    < Attribute
    IO         < Attribute
    String     < Attribute
    Time       < Attribute # Soon to be DateTime?