sqlite
| Kind | ffi-c |
|---|---|
| Categories | database ffi |
| Keywords | sqlite database sql ffi bindings |
SQLite bindings for Kit
Files
| File | Description |
|---|---|
kit.toml | Package manifest with metadata and dependencies |
src/sqlite.kit | SQLite database operations and query API |
tests/sqlite.test.kit | Tests for database connections and queries |
examples/basic.kit | Simple table creation and CRUD operations |
examples/chinook.kit | Queries against Chinook sample database |
examples/northwind.kit | Queries against Northwind sample database |
examples/sqlite.kit | General SQLite operations demo |
LICENSE | MIT license file |
Dependencies
No Kit package dependencies.
Installation
kit add gitlab.com/kit-lang/packages/kit-sqlite.gitUsage
import Kit.SqliteLicense
MIT License - see LICENSE for details.
Exported Functions & Types
sqlite-ok
SQLite operation completed successfully.
sqlite-row
SQLite query returned a row.
sqlite-done
SQLite query completed with no more rows.
sqlite-type-int
SQLite column type for integer values.
sqlite-type-float
SQLite column type for floating point values.
sqlite-type-text
SQLite column type for text strings.
sqlite-type-blob
SQLite column type for binary blob data.
sqlite-type-null
SQLite column type for NULL values.
SQLiteError
SQLite error type for typed error handling. Variants distinguish between different failure modes.
Variants
SQLiteOpenError {message}SQLitePrepareError {message}SQLiteQueryError {message}SQLiteExecError {message}SQLiteBindError {message}connect
Open a SQLite database connection and return a connection object with query/execute methods. Returns a connection record with query/execute methods.
String -> {handle: Ptr, driver: String, query: String -> Result List SQLiteError, execute: String -> Result Int SQLiteError}
db = SQLite.connect "example.sqlite"
result = db.query "SELECT * FROM users"
query
Execute a query and return all rows as a list of records with column names as keys. Each row is a Record with column names as keys. NULL values are represented as None, non-null values as Some value. Text values matching ISO8601 format (YYYY-MM-DD or YYYY-MM-DD HH:MM:SS) are automatically converted to DateTime.
Ptr -> String -> Result List SQLiteError
query-maps
Execute a query and return all rows as a list of maps with column names as keys. Each row is a Map with column names as keys. NULL values are represented as None, non-null values as Some value.
Ptr -> String -> Result List SQLiteError
query-raw
Execute a query and return all rows as a list of vectors in column order. Each row is a vector [col0, col1, col2, ...] in column order. This is more efficient than maps when you know the column order.
Ptr -> String -> Result List SQLiteError
execute
Execute a SQL statement (INSERT, UPDATE, DELETE, CREATE, etc.) and return affected row count. Returns number of affected rows on success, or error.
Ptr -> String -> Result Int SQLiteError