pogo

package module
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 27, 2024 License: MIT Imports: 8 Imported by: 0

README

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(uri string, outdir string, schemas ...string) error

Generate function

Types

type Driver

type Driver interface {
	Introspector
	Generator
}

Driver interface

type Generator

type Generator interface {
	Generate(imp *importer.Importer, schemas []string) (vfs.FileSystem, error)
}

Generator interface

type Introspector

type Introspector interface {
	Introspect(schemaName string) (*schema.Schema, error)
}

Introspector interface

Directories

Path Synopsis
cmd
internal
vfs

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL