Installation
Install Oro and configure SQLite, MySQL, or PostgreSQL.
Requirements
Oro currently targets Go 1.27rc1 while method-level generics are being used in the design.
source ~/.gvm/scripts/gvm && gvm use go1.27rc1
Add the module
go get github.com/duxweb/oro
Import a driver
import (
oro "github.com/duxweb/oro"
"github.com/duxweb/oro/driver/sqlite"
"github.com/duxweb/oro/driver/mysql"
"github.com/duxweb/oro/driver/pgsql"
_ "github.com/go-sql-driver/mysql"
_ "github.com/jackc/pgx/v5/stdlib"
_ "modernc.org/sqlite" // or _ "github.com/mattn/go-sqlite3"
)
Drivers are thin adapters over database/sql. Oro does not register concrete SQL drivers by itself; applications choose the concrete driver with normal blank imports, or pass an existing *sql.DB through Wrap.
SQLite
db, err := oro.Open(oro.Config{
Connections: map[string]oro.ConnectionConfig{
"default": {Driver: sqlite.Open("app.db")},
},
})
MySQL
db, err := oro.Open(oro.Config{
Connections: map[string]oro.ConnectionConfig{
"default": {
Driver: mysql.Open("root:root@tcp(localhost:3306)/duxorm?parseTime=true&multiStatements=false"),
},
},
})
PostgreSQL
db, err := oro.Open(oro.Config{
Connections: map[string]oro.ConnectionConfig{
"default": {
Driver: pgsql.Open("postgres://root@localhost:5432/duxorm?sslmode=disable"),
},
},
})
Docs development
The documentation site uses pnpm.
cd docs && pnpm install && pnpm run dev