Documentation
¶
Overview ¶
Package postgres provides a store implementation using Postgres.
Index ¶
- Constants
- func IsIntegrityConstraintViolation(err error) bool
- type Add
- type Client
- func (c *Client) Add() client.Add
- func (c *Client) Connect() error
- func (c *Client) MaxConnLifetime(timeout time.Duration) *Client
- func (c *Client) MaxConns(conns int) *Client
- func (c *Client) Migrations(fs fs.FS, directory string) *Client
- func (c *Client) Query() client.Query
- func (c *Client) Remove() client.Remove
- func (c *Client) Secondary(dsn string) *Client
- func (c *Client) Transaction(ctx context.Context) (client.Transaction, error)
- func (c *Client) Update() client.Update
- type Cond
- func (f Cond) And(another Cond) Cond
- func (f Cond) BeginsWith(key string, value string) Cond
- func (f Cond) Contains(key string, value interface{}) Cond
- func (f Cond) EndsWith(key string, value string) Cond
- func (f Cond) Eq(key string, value interface{}) Cond
- func (f Cond) Gt(key string, value interface{}) Cond
- func (f Cond) Lt(key string, value interface{}) Cond
- func (f Cond) NotContains(key string, value interface{}) Cond
- func (f Cond) NotEq(key string, value interface{}) Cond
- func (f Cond) Or(another Cond) Cond
- func (f Cond) Raw(sql string, args ...interface{}) Cond
- func (f Cond) ToSql() (string, []interface{}, error)
- type GooseLogger
- type PGXLogger
- type Pool
- type Query
- func (q *Query) After(key string, value *time.Time) client.Query
- func (q *Query) Complement(collection string, args ...interface{}) client.Query
- func (q *Query) Field(key string, args ...interface{}) client.Query
- func (q *Query) Fields(fields ...interface{}) client.Query
- func (q *Query) Filter(filter interface{}) client.Query
- func (q *Query) First(first int) client.Query
- func (q *Query) From(collection string) client.Query
- func (q *Query) Order(by string) client.Query
- func (q *Query) Secondary() client.Query
- func (q *Query) Statement() (string, []interface{}, error)
- func (q *Query) Transform(transform func(string) string) client.Query
- type Remove
- type Update
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 Client ¶ added in v0.0.2
type Client struct {
// contains filtered or unexported fields
}
Client is a client for interacting with Postgres.
func (*Client) MaxConnLifetime ¶ added in v0.0.2
MaxConnLifetime sets the max lifetime for a connection.
func (*Client) Migrations ¶ added in v0.0.2
Migrations sets the database migration configuration
func (*Client) Transaction ¶ added in v0.0.2
Transaction creates a database transaction for Postgres.
type Cond ¶ added in v0.0.26
type Cond struct {
// contains filtered or unexported fields
}
Cond is an instance of filter conditions for pg queries
func (Cond) BeginsWith ¶ added in v0.0.26
BeginsWith is the LIKE 'foo%' operation
func (Cond) Contains ¶ added in v0.0.26
Contains is the LIKE '%foo%' operation for strings or IN operator for arrays
func (Cond) NotContains ¶ added in v0.0.26
NotContains is the NOT LIKE '%foo%' operation for strings or NOT IN operator for arrays
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 {
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.
func (*Query) Complement ¶ added in v0.0.22
type Remove ¶
type Remove struct {
// contains filtered or unexported fields
}
Remove is an instance of the repository remove command for Postgres.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package integration provides resources for doing integration testing.
|
Package integration provides resources for doing integration testing. |