{"modulePath":"github.com/UnityTech/client-go","version":"v2.0.0+incompatible","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package fields\n\nPackage fields implements a simple field system, parsing and matching selectors with sets of fields.\n\n## Types\n\n```go\ntype Fields interface {\n\t// Has returns whether the provided field exists.\n\tHas(field string) (exists bool)\n\n\t// Get returns the value for the provided field.\n\tGet(field string) (value string)\n}\n```\nFields allows you to present fields independently from their storage.\n\n```go\ntype Requirement struct {\n\tOperator selection.Operator\n\tField    string\n\tValue    string\n}\n```\nRequirement contains a field, a value, and an operator that relates the field and value. This is currently for reading internal selection information of field selector.\n\n```go\ntype Requirements []Requirement\n```\nRequirements is AND of all requirements.\n\n```go\ntype Selector interface {\n\t// Matches returns true if this selector matches the given set of fields.\n\tMatches(Fields) bool\n\n\t// Empty returns true if this selector does not restrict the selection space.\n\tEmpty() bool\n\n\t// RequiresExactMatch allows a caller to introspect whether a given selector\n\t// requires a single specific field to be set, and if so returns the value it\n\t// requires.\n\tRequiresExactMatch(field string) (value string, found bool)\n\n\t// Transform returns a new copy of the selector after TransformFunc has been\n\t// applied to the entire selector, or an error if fn returns an error.\n\tTransform(fn TransformFunc) (Selector, error)\n\n\t// Requirements converts this interface to Requirements to expose\n\t// more detailed selection information.\n\tRequirements() Requirements\n\n\t// String returns a human readable string that represents this selector.\n\tString() string\n}\n```\nSelector represents a field selector.\n\n```go\nfunc Everything() Selector\n```\nEverything returns a selector that matches all fields.\n\n```go\nfunc OneTermEqualSelector(k, v string) Selector\n```\nOneTermEqualSelector returns an object that matches objects where one field/field equals one value. Cannot return an error.\n\n```go\nfunc ParseAndTransformSelector(selector string, fn TransformFunc) (Selector, error)\n```\nParses the selector and runs them through the given TransformFunc.\n\n```go\nfunc ParseSelector(selector string) (Selector, error)\n```\nParseSelector takes a string representing a selector and returns an object suitable for matching, or an error.\n\n```go\nfunc ParseSelectorOrDie(s string) Selector\n```\nParseSelectorOrDie takes a string representing a selector and returns an object suitable for matching, or panic when an error occur.\n\n```go\nfunc SelectorFromSet(ls Set) Selector\n```\nSelectorFromSet returns a Selector which will match exactly the given Set. A nil Set is considered equivalent to Everything().\n\n```go\ntype Set map[string]string\n```\nSet is a map of field:value. It implements Fields.\n\n```go\nfunc (ls Set) AsSelector() Selector\n```\nAsSelector converts fields into a selectors.\n\n```go\nfunc (ls Set) Get(field string) string\n```\nGet returns the value in the map for the provided field.\n\n```go\nfunc (ls Set) Has(field string) bool\n```\nHas returns whether the provided field exists in the map.\n\n```go\nfunc (ls Set) String() string\n```\nString returns all fields listed as a human readable string. Conveniently, exactly the format that ParseSelector takes.\n\n```go\ntype TransformFunc func(field, value string) (newField, newValue string, err error)\n```\nFunction to transform selectors.\n\n","path":"github.com/UnityTech/client-go/pkg/fields","name":"fields","synopsis":"Package fields implements a simple field system, parsing and matching selectors with sets of fields.","isRedistributable":true}
