telega_storage_sqlite

SQLite storage adapter for Telega.

Implements telega/storage.KeyValueStorage on top of a single SQLite table, giving small bots single-file persistence that survives restarts. TTL is stored as an epoch-millisecond expires_at column and enforced lazily on access (get/scan), matching the core ETS backend.

Values

pub fn migrate(
  conn: sqlight.Connection,
) -> Result(Nil, sqlight.Error)

Create the storage table if it does not exist. Run once at startup.

pub fn migrate_table(
  conn: sqlight.Connection,
  table: String,
) -> Result(Nil, sqlight.Error)

Create a custom-named storage table if it does not exist.

pub fn new(
  conn: sqlight.Connection,
) -> storage.KeyValueStorage(sqlight.Error)

Build a KeyValueStorage backed by the given SQLite connection.

Uses the default table name telega_storage. Call migrate once at startup to create the table.

pub fn new_with_table(
  conn: sqlight.Connection,
  table: String,
) -> storage.KeyValueStorage(sqlight.Error)

Like new, but with a custom table name.

Search Document