Portable SQL toolkit for Go — write database code once, run it on MySQL / MariaDB, PostgreSQL / CockroachDB and SQLite.
| Package | Description | Install |
|---|---|---|
| psql | Core: struct binding, query builder, transactions, associations | go get github.com/portablesql/psql |
| psql-mysql | MySQL / MariaDB driver | go get github.com/portablesql/psql-mysql |
| psql-pgsql | PostgreSQL / CockroachDB driver | go get github.com/portablesql/psql-pgsql |
| psql-sqlite | SQLite driver | go get github.com/portablesql/psql-sqlite |
import (
"github.com/portablesql/psql"
_ "github.com/portablesql/psql-sqlite" // or psql-mysql, psql-pgsql
)
be, err := psql.New(":memory:") // engine detected from the DSN
ctx := be.Plug(context.Background())Drivers register themselves on import, and only the driver you import gets downloaded.
- Website
- Getting Started and the other guides
- API reference