Documentation ¶
Overview ¶
Package postgres provides real connection to the PostgreSQL.
Index ¶
- type PgxPoolIface
- type Toggle
- func (t *Toggle) Delete(ctx context.Context, key string) error
- func (t *Toggle) GetAll(ctx context.Context, limit uint) ([]*entity.Toggle, error)
- func (t *Toggle) GetByKey(ctx context.Context, key string) (*entity.Toggle, error)
- func (t *Toggle) Insert(ctx context.Context, toggle *entity.Toggle) error
- func (t *Toggle) UpdateIsEnabled(ctx context.Context, key string, value bool) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PgxPoolIface ¶
type PgxPoolIface interface { Exec(ctx context.Context, sql string, arguments ...interface{}) (pgconn.CommandTag, error) Query(ctx context.Context, sql string, args ...interface{}) (pgx.Rows, error) QueryRow(ctx context.Context, sql string, args ...interface{}) pgx.Row Ping(ctx context.Context) error Close() }
PgxPoolIface defines a little interface for pgxpool functionality. Since in the real implementation we can use pgxpool.Pool, this interface exists mostly for testing purpose.
type Toggle ¶
type Toggle struct {
// contains filtered or unexported fields
}
Toggle is responsible to connect toggle entity with toggles table in PostgreSQL.
func (*Toggle) Delete ¶
Delete deletes a toggle from PostgreSQL. If the group doesn't exist, it doesn't returns error.
func (*Toggle) GetAll ¶
GetAll gets all available toggles from storage. If there isn't any toggle in repository, it returns empty list of toggle and nil error.
func (*Toggle) GetByKey ¶
GetByKey gets a toggle from database. It returns entity.ErrNotFound if toggle can't be found.