class DatabaseHistory
- DatabaseHistory
- Reference
- Object
Defined in:
privateparlor/history/database_history.crConstructors
-
.new(database : DB::Database, message_life : Time::Span)
Create an instance of DatabaseHistory and create the appropriate schema in the SQLite database.
Instance Method Summary
-
#add_rating(msid : Int64, uid : Int64) : Bool
Adds a rating entry to the karma table with the given data
-
#add_to_cache(origin_msid : Int64, msid : Int64, receiver_id : Int64) : Nil
Adds receiver_id and its associated msid to the receivers table
-
#add_warning(msid : Int64) : Nil
Set the warned attribute to true in message group associated with the given MSID.
- #db : DB::Database
-
#del_message_group(msid : Int64) : Int64 | Nil
Delete message group
- #delete_database_message_group(origin_msid : Int64 | Nil)
- #delete_expired_messages : Nil
-
#ensure_schema : Nil
Ensures that the DB schema for persisting message history is usable by the program.
-
#expire : Nil
Expire messages
-
#get_all_msids(msid : Int64) : Hash
Get all receivers for a message group associated with the given MSID
-
#get_msid(msid : Int64, receiver_id : Int64) : Int64 | Nil
Get receiver msid from the given MSID and receiver ID
-
#get_msids_from_user(uid : Int64) : Set(Int64)
Get all MSIDs sent by a user
-
#get_origin_msid(msid : Int64) : Int64 | Nil
Returns the messageGroupID from the given MSID, which may or may not be in in the receivers table
-
#get_sender_id(msid : Int64) : Int64 | Nil
Get sender_id of a specific message group
-
#get_warning(msid : Int64) : Bool | Nil
Returns true if the associated message group was warned; false otherwise.
- #lifespan : Time::Span
-
#new_message(sender_id : Int64, msid : Int64) : Int64
Adds a new entry to the message_groups table with the sender_id and its associated msid
Constructor Detail
Create an instance of DatabaseHistory and create the appropriate schema in the SQLite database.
Instance Method Detail
Adds a rating entry to the karma table with the given data
Returns true if the user was successfully added to the karma table; false if the user was already in it.
Adds receiver_id and its associated msid to the receivers table
Set the warned attribute to true in message group associated with the given MSID.
Ensures that the DB schema for persisting message history is usable by the program.
Get all receivers for a message group associated with the given MSID
Get receiver msid from the given MSID and receiver ID
Returns the messageGroupID from the given MSID, which may or may not be in in the receivers table
Returns true if the associated message group was warned; false otherwise.
Adds a new entry to the message_groups table with the sender_id and its associated msid
Returns the original msid of this message group