This is a no CGO sqlite driver for GOE ORM based on https://pkg.go.dev/modernc.org/sqlite.
- 🪝 Connection Hook
- 🧪 In Memory Database
package main
import (
"github.com/go-goe/goe"
"github.com/go-goe/sqlite"
)
type User struct {
ID int
Name string
Email string `goe:"unique"`
}
type Database struct {
User *User
*goe.DB
}
func main() {
db, err := goe.Open[Database](sqlite.Open("goe.db", sqlite.NewConfig(sqlite.Config{})))
}package main
import (
"github.com/go-goe/goe"
"github.com/go-goe/sqlite"
)
type User struct {
ID int
Name string
Email string `goe:"unique"`
}
type Database struct {
User *User
*goe.DB
}
func main() {
db, err := goe.Open[Database](sqlite.Open(filepath.Join(os.TempDir(), "goe.db"), sqlite.NewConfig(
sqlite.Config{
ConnectionHook: func(conn sqlite.ExecQuerierContext, dsn string) error {
conn.ExecContext(context.Background(), "PRAGMA foreign_keys = OFF;", nil)
return nil
},
},
)))
}package main
import (
"github.com/go-goe/goe"
"github.com/go-goe/sqlite"
)
type User struct {
ID int
Name string
Email string `goe:"unique"`
}
type Database struct {
User *User
*goe.DB
}
func main() {
db, err := goe.Open[Database](sqlite.OpenInMemory(sqlite.NewConfig(sqlite.Config{})))
}