https://github.com/tinywasm/sqlite
https://github.com/tinywasm/sqlite
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/tinywasm/sqlite
- Owner: tinywasm
- Created: 2023-05-22T23:53:50.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2026-03-31T15:11:46.000Z (3 months ago)
- Last Synced: 2026-03-31T17:26:49.852Z (3 months ago)
- Language: Go
- Size: 163 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
# sqlite

This is the `tinywasm/sqlite` adapter for `github.com/tinywasm/orm`.
## Usage
You can now initialize your database with a single line of code:
```go
package main
import (
"log"
"github.com/tinywasm/sqlite"
)
func main() {
// sqlite.Open returns a fully instantiated *orm.DB instance
db, err := sqlite.Open("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
// ...
}
```
## Update
`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.
```go
// ✅ 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)
```