Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/floattech/sqlite
A pure-go wrapper for database/sql using fumiama/sqlite3
https://github.com/floattech/sqlite
database go golang no-cgo sqlite sqlite3 sqlite3-orm
Last synced: 4 days ago
JSON representation
A pure-go wrapper for database/sql using fumiama/sqlite3
- Host: GitHub
- URL: https://github.com/floattech/sqlite
- Owner: FloatTech
- License: gpl-3.0
- Created: 2022-02-08T10:52:26.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-10-31T14:13:56.000Z (16 days ago)
- Last Synced: 2024-10-31T15:22:30.612Z (15 days ago)
- Topics: database, go, golang, no-cgo, sqlite, sqlite3, sqlite3-orm
- Language: Go
- Homepage:
- Size: 49.8 KB
- Stars: 5
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# sqlite
A pure-go wrapper for database/sql using logoove/sqlite## Usage
### 1. Replace modified sqlite lib in your go.mod
```bash
replace modernc.org/sqlite => github.com/fumiama/sqlite3 v1.29.10-simpreplace modernc.org/libc => github.com/fumiama/libc v0.0.0-20240530081950-6f6d8586b5c5
```### 2. Use it
```go
type row struct {
ID int // pk
Name string
}db := &sql.Sqlite{DBPath: "demo.db"}
err := db.Open(time.Hour)
if err != nil {
panic(err)
}err = db.Create("demotable", &row{})
if err != nil {
panic(err)
}err = db.Insert("demotable", &row{ID: 123, Name: "Anna"})
if err != nil {
panic(err)
}var r row
err = db.Find("demotable", &r, "WHERE ID=123")
if err != nil {
panic(err)
}
fmt.Println(r)
```