label

package
v0.30.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KeySearchOptions added in v0.25.0

type KeySearchOptions struct {
	Search string `json:"s,omitempty"`
	After  string `json:"a,omitempty"`

	// Omit specifies a list of key names to exclude from the results.
	Omit []string `json:"o,omitempty"`

	Limit int `json:"-"`
}

KeySearchOptions allow filtering and paginating the list of rotations.

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.

func (Label) Normalize

func (l Label) Normalize() (*Label, error)

Normalize will validate and normalize the label, returning a copy.

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store allows the lookup and management of Labels.

func NewStore added in v0.30.0

func NewStore(ctx context.Context, db *sql.DB) (*Store, error)

NewStore will Set a DB backend from a sql.DB. An error will be returned if statements fail to prepare.

func (*Store) FindAllByService

func (s *Store) FindAllByService(ctx context.Context, serviceID string) ([]Label, error)

FindAllByService finds all labels for a particular service. It returns all key-value pairs.

func (*Store) SearchKeys added in v0.25.0

func (s *Store) SearchKeys(ctx context.Context, opts *KeySearchOptions) ([]string, error)

func (*Store) SearchValues added in v0.25.0

func (s *Store) SearchValues(ctx context.Context, opts *ValueSearchOptions) ([]string, error)

func (*Store) SetTx

func (s *Store) SetTx(ctx context.Context, tx *sql.Tx, label *Label) error

SetTx will set a label for the service. It can be used to set the key-value pair for the label, delete a label or update the value given the label's key.

func (*Store) UniqueKeys

func (s *Store) UniqueKeys(ctx context.Context) ([]string, error)

func (*Store) UniqueKeysTx

func (s *Store) UniqueKeysTx(ctx context.Context, tx *sql.Tx) ([]string, error)

type ValueSearchOptions added in v0.25.0

type ValueSearchOptions struct {
	Key string `json:"k"`

	KeySearchOptions
}

ValueSearchOptions allow filtering and paginating the list of rotations.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL