Documentation ¶
Index ¶
- Variables
- func FamiliarMatch(pattern string, ref string) (bool, error)
- func ToParam(a Args) (string, error)
- type Args
- func (args Args) Add(key, value string)
- func (args Args) Contains(field string) bool
- func (args Args) Del(key, value string)
- func (args Args) ExactMatch(field, source string) bool
- func (args Args) Get(key string) []string
- func (args Args) Len() int
- func (args Args) MarshalJSON() ([]byte, error)
- func (args Args) MatchKVList(key string, sources map[string]string) bool
- func (args Args) UnmarshalJSON(raw []byte) error
- func (args Args) Validate(accepted map[string]bool) error
- type KeyValuePair
Constants ¶
This section is empty.
Variables ¶
var ErrBadFormat = errors.New("bad format of filter (expected name=value)")
ErrBadFormat is an error returned when a filter is not in the form key=value
Functions ¶
func FamiliarMatch ¶
FamiliarMatch decide the ref match the pattern or not
Types ¶
type Args ¶
type Args struct {
// contains filtered or unexported fields
}
Args stores filter arguments as map key:{map key: bool}. It contains an aggregation of the map of arguments (which are in the form of -f 'key=value') based on the key, and stores values for the same key in a map with string keys and boolean values. e.g given -f 'label=label1=1' -f 'label=label2=2' -f 'image.name=ubuntu' the args will be {"image.name":{"ubuntu":true},"label":{"label1=1":true,"label2=2":true}}
func FromFilterOpts ¶
FromFilterOpts parse key=value to Args string from cli opts
func NewArgs ¶
func NewArgs(initialArgs ...KeyValuePair) Args
NewArgs returns a new Args populated with the initial args
func (Args) ExactMatch ¶
ExactMatch returns true if the source matches exactly one of the filters.
func (Args) MarshalJSON ¶
MarshalJSON returns a JSON byte representation of the Args
func (Args) MatchKVList ¶
MatchKVList returns true if all the pairs in sources exist as key=value pairs in the mapping at key, or if there are no values at key.
func (Args) UnmarshalJSON ¶
UnmarshalJSON populates the Args from JSON encode bytes
type KeyValuePair ¶
KeyValuePair is used to initialize a new Args
func Arg ¶
func Arg(key, value string) KeyValuePair
Arg creates a new KeyValuePair for initializing Args