This repository implements the storage.Conn (from github.com/tinywasm/storage) and ddl.Compiler (from github.com/tinywasm/ddl) interfaces for PostgreSQL.
Instead of a global registry or init-driven registration, the PostgreSQL adapter is constructed explicitly:
package main
import (
"log"
"github.com/tinywasm/postgres"
)
func main() {
dsn := "postgres://user:password@localhost:5432/dbname?sslmode=disable"
// Open returns a storage.Conn
conn, err := postgres.Open(dsn)
if err != nil {
log.Fatal(err)
}
defer conn.Close()
// Use conn...
}- Full
storage.Connimplementation (unifying DML Compilation and Execution). - Transaction support via
BeginTxreturningstorage.TxBoundExecutor. - Secure SQL generation with parameterized queries using
$1,$2, etc. - Support for
Create,ReadOne,ReadAll,Update,DeleteDML actions. - Full DDL schema creation and compilation using
ddl.Compiler. - High-efficiency row scanning with
sql.ErrNoRowscleanly mapped tostorage.ErrNoRows. - Complies with
storage/conformanceandddl/conformancetest suites.