libsql
Types
pub type Connection
pub type ErrorCode {
Abort
Auth
Busy
Cantopen
Constraint
Corrupt
Done
Empty
GenericError
Format
Full
Internal
Interrupt
Ioerr
Locked
Mismatch
Misuse
Nolfs
Nomem
Notadb
Notfound
Notice
GenericOk
Perm
Protocol
Range
Readonly
Row
Schema
Toobig
Warning
AbortRollback
AuthUser
BusyRecovery
BusySnapshot
BusyTimeout
CantopenConvpath
CantopenDirtywal
CantopenFullpath
CantopenIsdir
CantopenNotempdir
CantopenSymlink
ConstraintCheck
ConstraintCommithook
ConstraintDatatype
ConstraintForeignkey
ConstraintFunction
ConstraintNotnull
ConstraintPinned
ConstraintPrimarykey
ConstraintRowid
ConstraintTrigger
ConstraintUnique
ConstraintVtab
CorruptIndex
CorruptSequence
CorruptVtab
ErrorMissingCollseq
ErrorRetry
ErrorSnapshot
IoerrAccess
IoerrAuth
IoerrBeginAtomic
IoerrBlocked
IoerrCheckreservedlock
IoerrClose
IoerrCommitAtomic
IoerrConvpath
IoerrCorruptfs
IoerrData
IoerrDelete
IoerrDeleteNoent
IoerrDirClose
IoerrDirFsync
IoerrFstat
IoerrFsync
IoerrGettemppath
IoerrLock
IoerrMmap
IoerrNomem
IoerrRdlock
}
Constructors
-
Abort -
Auth -
Busy -
Cantopen -
Constraint -
Corrupt -
Done -
Empty -
GenericError -
Format -
Full -
Internal -
Interrupt -
Ioerr -
Locked -
Mismatch -
Misuse -
Nolfs -
Nomem -
Notadb -
Notfound -
Notice -
GenericOk -
Perm -
Protocol -
Range -
Readonly -
Row -
Schema -
Toobig -
Warning -
AbortRollback -
AuthUser -
BusyRecovery -
BusySnapshot -
BusyTimeout -
CantopenConvpath -
CantopenDirtywal -
CantopenFullpath -
CantopenIsdir -
CantopenNotempdir -
CantopenSymlink -
ConstraintCheck -
ConstraintCommithook -
ConstraintDatatype -
ConstraintForeignkey -
ConstraintFunction -
ConstraintNotnull -
ConstraintPinned -
ConstraintPrimarykey -
ConstraintRowid -
ConstraintTrigger -
ConstraintUnique -
ConstraintVtab -
CorruptIndex -
CorruptSequence -
CorruptVtab -
ErrorMissingCollseq -
ErrorRetry -
ErrorSnapshot -
IoerrAccess -
IoerrAuth -
IoerrBeginAtomic -
IoerrBlocked -
IoerrCheckreservedlock -
IoerrClose -
IoerrCommitAtomic -
IoerrConvpath -
IoerrCorruptfs -
IoerrData -
IoerrDelete -
IoerrDeleteNoent -
IoerrDirClose -
IoerrDirFsync -
IoerrFstat -
IoerrFsync -
IoerrGettemppath -
IoerrLock -
IoerrMmap -
IoerrNomem -
IoerrRdlock
pub type Replicated {
Replicated(frame_no: option.Option(Int), frames_synced: Int)
}
Constructors
-
Replicated(frame_no: option.Option(Int), frames_synced: Int)
Values
pub fn begin(on connection: Connection) -> Result(Nil, Error)
pub fn changes(connection: Connection) -> Result(Int, Error)
pub fn close(connection: Connection) -> Result(Nil, Error)
pub fn commit(on connection: Connection) -> Result(Nil, Error)
pub fn decode_bool() -> decode.Decoder(Bool)
pub fn error_code_from_int(code: Int) -> ErrorCode
pub fn error_code_to_int(error: ErrorCode) -> Int
pub fn exec(
sql: String,
on connection: Connection,
) -> Result(Nil, Error)
pub fn exec_batch(
sql: String,
on connection: Connection,
with batches: List(List(Value)),
) -> Result(Nil, Error)
pub fn interrupt(connection: Connection) -> Result(Nil, Error)
pub fn last_insert_rowid(
connection: Connection,
) -> Result(Int, Error)
pub fn nullable(
inner_type: fn(t) -> Value,
value: option.Option(t),
) -> Value
pub fn open(path: String) -> Result(Connection, Error)
pub fn open_remote(
url: String,
token: String,
) -> Result(Connection, Error)
pub fn open_replica(
path: String,
url: String,
token: String,
) -> Result(Connection, Error)
pub fn open_synced_database(
path: String,
url: String,
token: String,
) -> Result(Connection, Error)
pub fn prepare(
sql: String,
on connection: Connection,
) -> Result(Statement, Error)
pub fn query(
sql: String,
on connection: Connection,
with arguments: List(Value),
expecting decoder: decode.Decoder(t),
) -> Result(List(t), Error)
pub fn query_first(
sql: String,
on connection: Connection,
with arguments: List(Value),
expecting decoder: decode.Decoder(t),
) -> Result(option.Option(t), Error)
pub fn query_first_named(
sql: String,
on connection: Connection,
with arguments: List(#(String, Value)),
expecting decoder: decode.Decoder(t),
) -> Result(option.Option(t), Error)
pub fn query_named(
sql: String,
on connection: Connection,
with arguments: List(#(String, Value)),
expecting decoder: decode.Decoder(t),
) -> Result(List(t), Error)
pub fn query_one(
sql: String,
on connection: Connection,
with arguments: List(Value),
expecting decoder: decode.Decoder(t),
) -> Result(t, Error)
pub fn query_one_named(
sql: String,
on connection: Connection,
with arguments: List(#(String, Value)),
expecting decoder: decode.Decoder(t),
) -> Result(t, Error)
pub fn query_prepared(
on statement: Statement,
with params: List(Value),
expecting decoder: decode.Decoder(t),
) -> Result(List(t), Error)
pub fn replication_index(
connection: Connection,
) -> Result(option.Option(Int), Error)
pub fn rollback(on connection: Connection) -> Result(Nil, Error)
pub fn sync(connection: Connection) -> Result(Replicated, Error)
pub fn total_changes(
connection: Connection,
) -> Result(Int, Error)
pub fn transaction(
on connection: Connection,
run f: fn() -> Result(a, Error),
) -> Result(a, Error)
pub fn with_connection(path: String, f: fn(Connection) -> a) -> a
pub fn with_remote_connection(
url: String,
token: String,
f: fn(Connection) -> a,
) -> a
pub fn with_replica_connection(
path: String,
url: String,
token: String,
f: fn(Connection) -> a,
) -> a
pub fn with_statement(
sql: String,
on connection: Connection,
run f: fn(Statement) -> a,
) -> a
pub fn with_synced_database(
path: String,
url: String,
token: String,
f: fn(Connection) -> a,
) -> a