module

Takarik::Data

Constants

Log = ::Log.for("takarik-data")

Logger for database queries

VERSION = "0.1.0"

Class methods

connection
Source
establish_connection(database_url : String)
Source
exec_with_logging(connection : DB::Database, sql : String, args : Array(DB::Any) | Nil = nil, model_name : String | Nil = nil, operation : String | Nil = nil)

Helper method to execute and log queries

Source
exec_with_logging(connection : DB::Connection, sql : String, args : Array(DB::Any), model_name : String | Nil = nil, operation : String | Nil = nil)

Helper method to execute and log queries within transactions with args array

Source
exec_with_logging(connection : DB::Database | DB::Connection, sql : String, args : Array(DB::Any), model_name : String | Nil = nil, operation : String | Nil = nil)

Helper method to handle both DB::Database and DB::Connection with args array

Source
exec_with_logging(connection : DB::Connection, sql : String, *args : DB::Any)

Helper method to execute and log queries within transactions

Source
log_query(sql : String, params : Array(DB::Any) | Nil = nil, execution_time : Time::Span | Nil = nil, model_name : String | Nil = nil, operation : String | Nil = nil)

Helper method to log database queries

Source
query_observer
Source
query_observer=(observer : Proc(Nil) | Nil)
Source
query_with_logging(connection : DB::Database, sql : String, args : Array(DB::Any) | Nil = nil, model_name : String | Nil = nil, operation : String | Nil = nil, &block : DB::ResultSet -> )

Helper method to execute query with logging and yield result set

Source
scalar_with_logging(connection : DB::Database, sql : String, args : Array(DB::Any) | Nil = nil, model_name : String | Nil = nil, operation : String | Nil = nil)

Helper method to execute scalar queries with logging

Source

Nested types