title: “DB::CONNECT Function” date: 2025-07-04 author: “laplante@plcb.ca” version: “1.0.0”
db::connect — establish and return a database connection
db::open(dsn)
The db::connect
function opens a database connection and returns a database object.
It should be called before performing any SQL operations and closed afterwards to free resources.
dsn := "goweb:goweb@tcp(127.0.0.1:3306)/goweb";
db := db::connect(dsn);
sql(db:db, "show tables");
db::close(db);
laplante@plcb.ca