pig/workspace
Types
Errors that can occur when working with a workspace.
pub type Error {
SqlError(sqlight.Error)
NotFound(path: String)
NotEmpty(path: String)
AlreadyExists(path: String)
InvalidPath(path: String)
KeyError(key: String)
}
Constructors
-
SqlError(sqlight.Error) -
NotFound(path: String) -
NotEmpty(path: String) -
AlreadyExists(path: String) -
InvalidPath(path: String) -
KeyError(key: String)
Values
pub fn connection(ws: Workspace) -> sqlight.Connection
Get the underlying connection (escape hatch for power users).
pub fn delete_file(
ws: Workspace,
path: String,
) -> Result(Nil, Error)
Delete a file or empty directory.
pub fn list_directory(
ws: Workspace,
path: String,
) -> Result(List(String), Error)
List entries in a directory.
pub fn list_keys(
ws: Workspace,
prefix: String,
) -> Result(List(String), Error)
List keys matching a prefix.
pub fn open(path: String) -> Result(Workspace, Error)
Open a workspace database. Creates if doesn’t exist.
pub fn read_file(
ws: Workspace,
path: String,
) -> Result(String, Error)
Read the full content of a file.
pub fn read_file_lines(
ws: Workspace,
path: String,
offset: Int,
limit: Int,
) -> Result(String, Error)
Read lines with offset/limit, formatted with line numbers.
pub fn remember(
ws: Workspace,
key: String,
value: String,
) -> Result(Nil, Error)
Store a key-value pair.