Documentation
¶
Index ¶
- type DB
- func (db *DB) FindAllByService(ctx context.Context, serviceID string) ([]Label, error)
- func (db *DB) Search(ctx context.Context, opts *SearchOptions) ([]Label, error)
- func (db *DB) SetTx(ctx context.Context, tx *sql.Tx, label *Label) error
- func (db *DB) UniqueKeys(ctx context.Context) ([]string, error)
- func (db *DB) UniqueKeysTx(ctx context.Context, tx *sql.Tx) ([]string, error)
- type Label
- type SearchCursor
- type SearchOptions
- type Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB implements the Store interface using a postgres database.
func NewDB ¶
NewDB will Set a DB backend from a sql.DB. An error will be returned if statements fail to prepare.
func (*DB) FindAllByService ¶
FindAllByService finds all labels for a particular service. It returns all key-value pairs.
type Label ¶
type Label struct {
Target assignment.Target
Key string `json:"key"`
Value string `json:"value"`
}
A Label is a key-value pair assigned to a target.
type SearchCursor ¶
type SearchCursor struct {
Key string `json:"k,omitempty"`
TargetID string `json:"t,omitempty"`
TargetType assignment.TargetType `json:"y,omitempty"`
}
SearchCursor is used to indicate a position in a paginated list.
type SearchOptions ¶
type SearchOptions struct {
Search string `json:"s,omitempty"`
After SearchCursor `json:"a,omitempty"`
// Omit specifies a list of key names to exclude from the results.
Omit []string `json:"o,omitempty"`
Limit int `json:"-"`
UniqueKeys bool `json:"u,omitempty"`
}
SearchOptions allow filtering and paginating the list of rotations.
type Store ¶
type Store interface {
SetTx(ctx context.Context, tx *sql.Tx, label *Label) error
FindAllByService(ctx context.Context, serviceID string) ([]Label, error)
UniqueKeysTx(ctx context.Context, tx *sql.Tx) ([]string, error)
UniqueKeys(ctx context.Context) ([]string, error)
Search(ctx context.Context, opts *SearchOptions) ([]Label, error)
}
Store allows the lookup and management of Labels.
Click to show internal directories.
Click to hide internal directories.