module Guff class TemplateDatabase def initialize(@db : Database, @templates : TemplateCache) end def one( key : Symbol, args : Array(String) | Hash(String, String) | Nil, tmpl_args : Hash(String, String)? ) @db.one(template(key, tmpl_args), args) end def row( key : Symbol, args : Array(String) | Hash(String, String) | Nil, tmpl_args : Hash(String, String)?, ) @db.row(template(key, tmpl_args), args) end def all( key : Symbol, args : Array(String) | Hash(String, String) | Nil, tmpl_args : Hash(String, String)?, &block : Hash(String, ::SQLite3::Value) -> \ ) @db.all(template(key, tmpl_args), args, &block) end def query( key : Symbol, args : Array(String) | Hash(String, String) | Nil, tmpl_args : Hash(String, String)? ) @db.query(template(key, tmpl_args), args) end def template( key : Symbol, args : Hash(String, String)? ) @templates[key].run(args) end def last_insert_row_id @db.last_insert_row_id end def quote(s) : String @db.quote(s) end def transaction(&block) @db.transaction(&block) end end end