Installation
Add dbswitch and a backend to your Go module.
Requires Go 1.26+.
Core package
The core dbswitch package has no third-party dependencies:
go get github.com/anukool23/dbswitch@latestBackend
Each backend lives in its own sub-package, so you only pull in a driver you actually use.
PostgreSQL (brings in jackc/pgx):
go get github.com/anukool23/dbswitch/postgresMongoDB (brings in the official Go driver):
go get github.com/anukool23/dbswitch/mongoDynamoDB (brings in aws-sdk-go-v2):
go get github.com/anukool23/dbswitch/dynamodbImport
import (
"github.com/anukool23/dbswitch"
"github.com/anukool23/dbswitch/postgres" // or .../mongo, .../dynamodb
)Use the dbswitch package to describe schema (Table, Column, types, defaults), the
shared Store interface, and shared errors; use a backend package (postgres, mongo,
or dynamodb) to open a connection and run CRUD. Continue to the Quick start,
then see Backends for the differences between them.