Documentation ¶
Index ¶
- type PostgresAPI
- type PostgresClient
- func (p *PostgresClient) Delete(ctx context.Context, id string, options ...store.DeleteOptions) error
- func (p *PostgresClient) Get(ctx context.Context, id string, options ...store.GetOptions) (*store.Object, error)
- func (p *PostgresClient) Query(ctx context.Context, query store.Query, options ...store.QueryOptions) (*store.ObjectQueryResult, error)
- func (p *PostgresClient) Save(ctx context.Context, obj *store.Object, options ...store.SaveOptions) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PostgresAPI ¶
type PostgresAPI interface { // Exec executes a query without returning any rows. Exec(ctx context.Context, sql string, args ...any) (pgconn.CommandTag, error) // QueryRow executes a query that is expected to return at most one row. QueryRow(ctx context.Context, sql string, args ...any) pgx.Row // Query executes a query that returns rows. Query(ctx context.Context, sql string, args ...any) (pgx.Rows, error) }
PostgresAPI defines the API surface from pgx that we use. This is used to allow for easier testing.
Keep these definitions in sync with pgxpool.Pool and pgx.Conn.
type PostgresClient ¶
type PostgresClient struct {
// contains filtered or unexported fields
}
PostgresClient is a storage client that uses Postgres as the backend.
func NewPostgresClient ¶
func NewPostgresClient(api PostgresAPI) *PostgresClient
NewPostgresClient creates a new PostgresClient.
func (*PostgresClient) Delete ¶
func (p *PostgresClient) Delete(ctx context.Context, id string, options ...store.DeleteOptions) error
Delete implements store.StorageClient.
func (*PostgresClient) Get ¶
func (p *PostgresClient) Get(ctx context.Context, id string, options ...store.GetOptions) (*store.Object, error)
Get implements store.StorageClient.
func (*PostgresClient) Query ¶
func (p *PostgresClient) Query(ctx context.Context, query store.Query, options ...store.QueryOptions) (*store.ObjectQueryResult, error)
Query implements store.StorageClient.
func (*PostgresClient) Save ¶
func (p *PostgresClient) Save(ctx context.Context, obj *store.Object, options ...store.SaveOptions) error
Save implements store.StorageClient.
Click to show internal directories.
Click to hide internal directories.