class Tourmaline::DBPersistence

Overview

Stores all persisted data in a database. The database you use is up to you, just make sure to reuqire the appropriate adapter.

A DB::Database instance should be passed to the initializer.

Defined in:

tourmaline/persistence/db_persistence.cr

Constructors

Instance Method Summary

Instance methods inherited from class Tourmaline::Persistence

chat_exists?(chat_id : Int) : Bool
chat_exists?(username : String) : Bool
chat_exists?
, get_chat(chat_id : Int) : Chat | Nil
get_chat(username : String) : Chat | Nil
get_chat
, get_user(user_id : Int) : User | Nil
get_user(username : String) : User | Nil
get_user
, handle_persistent_update(update : Update) handle_persistent_update, persistent_cleanup persistent_cleanup, persistent_init persistent_init, update_chat(chat : Chat) : Chat update_chat, update_user(user : User) : User update_user, user_exists?(user_id : Int) : Bool
user_exists?(usename : String) : Bool
user_exists?

Constructor Detail

def self.new(db : DB::Database, users_table : String = "users", chats_table : String = "chats") #

[View source]

Instance Method Detail

def chat_exists?(chat_id : Int) : Bool #

[View source]
def chat_exists?(username : String) : Bool #

[View source]
def chats_table : String #

[View source]
def chats_table=(chats_table : String) #

[View source]
def db : DB::Database #

[View source]
def get_chat(chat_id : Int) : Chat | Nil #

[View source]
def get_chat(username : String) : Chat | Nil #

[View source]
def get_user(user_id : Int) : User | Nil #

[View source]
def get_user(username : String) : User | Nil #

[View source]
def handle_persistent_update(update : Update) #

[View source]
def persistent_cleanup #

[View source]
def persistent_init #

[View source]
def update_chat(chat : Chat) : Chat #

[View source]
def update_user(user : User) : User #

[View source]
def user_exists?(user_id : Int) : Bool #

[View source]
def user_exists?(username : String) : Bool #

[View source]
def users_table : String #

[View source]
def users_table=(users_table : String) #

[View source]