class Prostore::TUI::Browser

Defined in:

prostore/tui/browser.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(conn : Connection) #

[View source]

Instance Method Detail

def count(table : String, filter : Filter | Nil = nil) : Int64 #

[View source]
def delete_row(table : String, pk_col : String, pk_val : String) : Nil #

[View source]
def enum_columns(table : String) : Hash(String, EnumColumn) #

Returns enum metadata keyed by column name, for columns whose portable type is enum_string or enum_int. Columns without enum metadata are omitted. Returns an empty hash if the bookkeeping table doesn't exist (database not managed by prostore). Reuses the typed SchemaTable reader so the JSON-decoded enum_members array is honoured exactly as written by the migration runner.


[View source]
def fetch_row(table : String, pk_col : String, pk_val : String) : Hash(String, RowVal) | Nil #

Fetch a single row by its primary key value.


[View source]
def fetch_rows(table : String, limit : Int32, offset : Int32, filter : Filter | Nil = nil) : Tuple(Array(String), Array(Row)) #

Returns column names and rows. Values are String or nil.


[View source]
def insert_row(table : String, data : Hash(String, String | Nil)) : Nil #

data values may be nil to bind explicit NULL. Columns the caller wants the database default for should simply be omitted from data.


[View source]
def pk_col(table : String) : String | Nil #

Returns the primary key column name, or nil if none found.


[View source]
def portable_types(table : String) : Hash(String, String) #

Returns prostore portable type tags keyed by column name, read from the prostore_schema bookkeeping table. Returns an empty hash if the table doesn't exist (database not managed by prostore — caller should fall back to SQL type_text inference).


[View source]
def schema(table : String) : Adapter::LiveTable #

[View source]
def tables : Array(String) #

[View source]
def update_cell(table : String, pk_col : String, pk_val : String, column : String, value : String | Nil) : Nil #

[View source]