pogo

Type-safe Database Client for Go. Supports PostgreSQL and SQLite.

MIT License

Stars
0

Pogo

Type-safe Database Client for Go. Supports PostgreSQL and SQLite.

The code is stable and has been in production for many years now including Standup Jack.

Usage

Introspect your database

# connect to a postgres database and build the client in pogo/
pogo --db $(POSTGRES_URL) --schema public --dir ./pogo

Using the Generated Client

pgconfig, err := pgx.ParseURI(env.DatabaseURL)
if err != nil {
  return err
}
db, err := pgx.Connect(pgconfig)
if err != nil {
  return err
}

users, err := user.FindMany(db,
  user.NewFilter().Email("[email protected]"),
  user.NewOrder().CreatedAt(user.DESC),
)

Check out the tests for more usage examples.

Development

Running Tests

To run the tests, you'll need to have PostgreSQL installed locally with an empty pogo database:

createdb pogo
make test

License

MIT

Package Rankings
Top 8.17% on Proxy.golang.org