Documentation
¶
Overview ¶
Package postgres provides a store implementation using Postgres.
Index ¶
- Constants
- func Filter() datastore.Filter
- func IsIntegrityConstraintViolation(err error) bool
- func NewCursor(rows pgx.Rows) datastore.Cursor
- type Add
- type Cursor
- type GooseLogger
- type PGXLogger
- type Pool
- type Query
- func (q *Query) After(key string, value interface{}) datastore.Query
- func (q *Query) And(collection string, args ...interface{}) datastore.Query
- func (q *Query) Execute(ctx context.Context) (datastore.Cursor, error)
- func (q *Query) Filter(filter datastore.Filter) datastore.Query
- func (q *Query) First(first int) datastore.Query
- func (q *Query) From(collection string) datastore.Query
- func (q *Query) Order(by string) datastore.Query
- func (q *Query) Return(key string, args ...interface{}) datastore.Query
- func (q *Query) Secondary() datastore.Query
- func (q *Query) Statement() (string, []interface{}, error)
- type Remove
- func (r *Remove) After(key string, value interface{}) datastore.Remove
- func (r *Remove) Execute(ctx context.Context) (int, error)
- func (r *Remove) Filter(filter datastore.Filter) datastore.Remove
- func (r *Remove) First(first int) datastore.Remove
- func (r *Remove) From(collection string) datastore.Remove
- func (r *Remove) Order(by string) datastore.Remove
- func (r *Remove) Statement() (string, []interface{}, error)
- type Store
- func (s *Store) Add() datastore.Add
- func (s *Store) Connect() error
- func (s *Store) Filter() datastore.Filter
- func (s *Store) MaxConnLifetime(timeout time.Duration) *Store
- func (s *Store) MaxConns(conns int) *Store
- func (s *Store) Migrations(fs fs.FS, directory string) *Store
- func (s *Store) Query() datastore.Query
- func (s *Store) Remove() datastore.Remove
- func (s *Store) Secondary(dsn string) *Store
- func (s *Store) Transaction(ctx context.Context) (datastore.Transaction, error)
- func (s *Store) Update() datastore.Update
- type Update
- func (a *Update) Execute(ctx context.Context) (int, error)
- func (a *Update) Filter(filter datastore.Filter) datastore.Update
- func (a *Update) In(collection string) datastore.Update
- func (a *Update) Item(snapshot map[string]interface{}) datastore.Update
- func (a *Update) Statement() (string, []interface{}, error)
Constants ¶
const (
// DefaultSQLMaxOpenConns is the default maximum number of open connections.
DefaultSQLMaxOpenConns = 100
)
Variables ¶
This section is empty.
Functions ¶
func IsIntegrityConstraintViolation ¶
IsIntegrityConstraintViolation checks if the error is an integrity constraint violation.
Types ¶
type Add ¶
type Add struct {
// contains filtered or unexported fields
}
Add is an instance of the add repository command using Postgres.
type Cursor ¶
type Cursor struct {
// contains filtered or unexported fields
}
Cursor represents an instance of a Cursor
type GooseLogger ¶
type GooseLogger struct{}
GooseLogger is a custom logger for the goose package
func (*GooseLogger) Fatal ¶
func (g *GooseLogger) Fatal(v ...interface{})
func (*GooseLogger) Fatalf ¶
func (g *GooseLogger) Fatalf(format string, v ...interface{})
func (*GooseLogger) Print ¶
func (g *GooseLogger) Print(v ...interface{})
func (*GooseLogger) Printf ¶
func (g *GooseLogger) Printf(format string, v ...interface{})
func (*GooseLogger) Println ¶
func (g *GooseLogger) Println(v ...interface{})
type Pool ¶
type Pool interface {
Query(ctx context.Context, sql string, args ...interface{}) (pgx.Rows, error)
Exec(ctx context.Context, sql string, args ...interface{}) (pgconn.CommandTag, error)
Begin(ctx context.Context) (pgx.Tx, error)
}
Pool for executing db commands against.
type Query ¶
type Query struct {
// contains filtered or unexported fields
}
Query is an instance of the repository query for Postgres.
type Remove ¶
type Remove struct {
// contains filtered or unexported fields
}
Remove is an instance of the repository remove command for Postgres.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is a client for interacting with Postgres.
func (*Store) MaxConnLifetime ¶
MaxConnLifetime sets the max lifetime for a connection.
func (*Store) Migrations ¶
Migrations sets the database migration configuration
func (*Store) Transaction ¶
Transaction creates a database transaction for Postgres.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package integration provides resources for doing integration testing.
|
Package integration provides resources for doing integration testing. |