This is the tinywasm/sqlite adapter for github.com/tinywasm/orm.
The adapter registers itself under the "sqlite" scheme. You can open a database using sqlite.Open directly or via orm.Open:
package main
import (
"log"
"github.com/tinywasm/orm"
"github.com/tinywasm/sqlite"
)
func main() {
// Directly:
db, err := sqlite.Open("my_database.sqlite")
// Or via the registry (uses normalizeDSN to handle sqlite:// and sqlite::memory:):
db, err = orm.Open("sqlite://my_database.sqlite")
if err != nil {
log.Fatalf("failed to open database: %v", err)
}
defer sqlite.Close(db)
// Ready to use db via github.com/tinywasm/orm fluent API
// ...
}- Registry Support: Registers as
"sqlite"toorm.Register. - Error Mapping: Automatically maps
sql.ErrNoRowstoorm.ErrNoRows. - Schema Introspection: Implements
TableIntrospectorfordb.SyncSchemasupport, enabling column renames and drops. - WASM Compatible: Uses
modernc.org/sqlitefor pure Go/CGO-less execution.
db.Update always requires at least one Condition. This is enforced at
compile time by tinywasm/orm. There is no "update by PK implicitly" magic.
// ✅ Correct
if err := db.Update(&user, orm.Eq("id", user.ID)); err != nil { ... }
// ❌ Compile error (caught by tinywasm/orm — will not reach the SQLite layer)
db.Update(&user)