feather

Types

pub type Config {
  Config(
    file: String,
    journal_mode: JournalMode,
    synchronous: SyncMode,
    temp_store: TempStore,
    mmap_size: Option(Int),
    page_size: Option(Int),
    foreign_keys: Bool,
  )
}

Constructors

  • Config(
      file: String,
      journal_mode: JournalMode,
      synchronous: SyncMode,
      temp_store: TempStore,
      mmap_size: Option(Int),
      page_size: Option(Int),
      foreign_keys: Bool,
    )
pub type JournalMode {
  JournalDelete
  JournalTruncate
  JournalPersist
  JournalMemory
  JournalWal
  JournalOff
}

Constructors

  • JournalDelete
  • JournalTruncate
  • JournalPersist
  • JournalMemory
  • JournalWal
  • JournalOff
pub type SyncMode {
  SyncExtra
  SyncFull
  SyncNormal
  SyncOff
}

Constructors

  • SyncExtra
  • SyncFull
  • SyncNormal
  • SyncOff
pub type TempStore {
  TempStoreDefault
  TempStoreFile
  TempStoreMemory
}

Constructors

  • TempStoreDefault
  • TempStoreFile
  • TempStoreMemory

Functions

pub fn connect(config: Config) -> Result(Connection, Error)
pub fn default_config() -> Config
pub fn disconnect(connection: Connection) -> Result(Nil, Error)

runs “PRAGMA optimize;” before closing the connection. If the connections are long-lived, then consider running this periodically anyways.

pub fn main() -> Nil

Runs the feather cli to generate new migrations and dump the schema you probably don’t wanna run this yourself… run gleam run -m feather to find out more

pub fn optimize(connection: Connection) -> Result(Nil, Error)
pub fn with_connection(
  config: Config,
  fxn: fn(Connection) -> a,
) -> Result(a, Error)

Created a short lived connection, runs the included function on it, and then disconnects. If the connection could not be established, the callback function is not run, and this function returns an Error.

This is particularly nice to use with use expressions:

use connection <- with_connection(default_config())

let result = sqlight.query(...)
Search Document