Documentation
¶
Overview ¶
Package dbmod is the native module "db": SQL databases through Go's database/sql. The first database is SQLite (modernc.org/sqlite, pure Go, so no C library is needed).
use db;
local conn = db::open("sqlite:shop.db");
conn->exec("CREATE TABLE IF NOT EXISTS items (name TEXT, price REAL)");
conn->exec("INSERT INTO items VALUES (?, ?)", "pen", 1.5);
for (local row in conn->query("SELECT * FROM items WHERE price < ?", 10))
println(row["name"], row["price"]);
conn->close();
Values always travel as parameters (?), never glued into the SQL text.
Index ¶
Constants ¶
View Source
const DBError = "DBError"
DBError is the kind of the exceptions the database reports: an SQL error, a broken constraint, a database file that cannot be opened.
Variables ¶
View Source
var ( Conn = &native.Class{Name: "Conn"} Cursor = &native.Class{Name: "Cursor"} )
Conn and Cursor are the classes db::Conn and db::Cursor.
View Source
var Query = &native.Class{Name: "Query"}
Query is the class db::Query: conn->find(C) and its refinements.
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.