Documentation
¶
Index ¶
- type Config
- type PostgresAdapter
- func (p *PostgresAdapter) Close() error
- func (p *PostgresAdapter) Count(ctx context.Context, query *core.Query) (int64, error)
- func (p *PostgresAdapter) Create(ctx context.Context, model string, data map[string]interface{}) (map[string]interface{}, error)
- func (p *PostgresAdapter) Delete(ctx context.Context, query *core.Query) error
- func (p *PostgresAdapter) DeleteMany(ctx context.Context, query *core.Query) (int64, error)
- func (p *PostgresAdapter) FindMany(ctx context.Context, query *core.Query) ([]map[string]interface{}, error)
- func (p *PostgresAdapter) FindOne(ctx context.Context, query *core.Query) (map[string]interface{}, error)
- func (p *PostgresAdapter) ID() string
- func (p *PostgresAdapter) Ping(ctx context.Context) error
- func (p *PostgresAdapter) Transaction(ctx context.Context, fn func(core.Adapter) error) error
- func (p *PostgresAdapter) Update(ctx context.Context, query *core.Query, data map[string]interface{}) (map[string]interface{}, error)
- func (p *PostgresAdapter) UpdateMany(ctx context.Context, query *core.Query, data map[string]interface{}) (int64, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Host string
Port int
Database string
Username string
Password string
SSLMode string
MaxConns int32
MinConns int32
}
Config holds PostgreSQL configuration
type PostgresAdapter ¶
type PostgresAdapter struct {
// contains filtered or unexported fields
}
PostgresAdapter implements the Adapter interface for PostgreSQL
func New ¶
func New(ctx context.Context, cfg *Config) (*PostgresAdapter, error)
New creates a new PostgreSQL adapter
func (*PostgresAdapter) Close ¶
func (p *PostgresAdapter) Close() error
Close closes the connection pool
func (*PostgresAdapter) Create ¶
func (p *PostgresAdapter) Create(ctx context.Context, model string, data map[string]interface{}) (map[string]interface{}, error)
Create creates a new record
func (*PostgresAdapter) DeleteMany ¶
DeleteMany deletes all records matching the query
func (*PostgresAdapter) FindMany ¶
func (p *PostgresAdapter) FindMany(ctx context.Context, query *core.Query) ([]map[string]interface{}, error)
FindMany finds all records matching the query
func (*PostgresAdapter) FindOne ¶
func (p *PostgresAdapter) FindOne(ctx context.Context, query *core.Query) (map[string]interface{}, error)
FindOne finds a single record matching the query
func (*PostgresAdapter) ID ¶
func (p *PostgresAdapter) ID() string
ID returns the adapter identifier
func (*PostgresAdapter) Ping ¶
func (p *PostgresAdapter) Ping(ctx context.Context) error
Ping checks the connection
func (*PostgresAdapter) Transaction ¶
Transaction executes a function in a transaction
func (*PostgresAdapter) Update ¶
func (p *PostgresAdapter) Update(ctx context.Context, query *core.Query, data map[string]interface{}) (map[string]interface{}, error)
Update updates a single record matching the query
func (*PostgresAdapter) UpdateMany ¶
func (p *PostgresAdapter) UpdateMany(ctx context.Context, query *core.Query, data map[string]interface{}) (int64, error)
UpdateMany updates all records matching the query
Click to show internal directories.
Click to hide internal directories.