type Expression struct { }
Expression represents an attribute path with expression steps, which can represent zero, one, or more actual paths in schema data. This logic is either based on an absolute path starting at the root of the schema data, similar to Path, or a relative path which is intended to be merged with an existing absolute path.
Use the MatchRoot() function to create an Expression for an absolute path with an initial AtName() step. Use the MatchRelative() function to create an Expression for a relative path, which will be merged with an existing absolute path.
Similar to Path, Expression functionality has some overlapping method names and follows a builder pattern, which allows for chaining method calls to construct a full expression. The available traversal steps after Expression creation are:
For example, to express any list element with a root list attribute named "some_attribute":
path.MatchRoot("some_attribute").AtAnyListIndex()
An Expression is generally preferable over a Path in schema-defined functionality that is intended to accept paths as parameters, such as attribute validators and attribute plan modifiers, since it allows consumers to support relative paths. Use the Merge() or MergeExpressions() method to combine the current attribute path expression with those expression(s).
To find Paths from an Expression in schema based data structures, such as tfsdk.Config, tfsdk.Plan, and tfsdk.State, use their PathMatches() method.
MatchRelative creates an empty attribute path expression that is intended to be combined with an existing attribute path expression. This allows creating a relative expression in nested schemas, using AtParent() to traverse up the path or other At methods to traverse further down.
MatchRoot creates an attribute path expression starting with ExpressionStepAttributeNameExact.
AtAnyListIndex returns a copied expression with a new list index step at the end. The returned path is safe to modify without affecting the original.
AtAnyMapKey returns a copied expression with a new map key step at the end. The returned path is safe to modify without affecting the original.
AtAnySetValue returns a copied expression with a new set value step at the end. The returned path is safe to modify without affecting the original.
AtListIndex returns a copied expression with a new list index step at the end. The returned path is safe to modify without affecting the original.
AtMapKey returns a copied expression with a new map key step at the end. The returned path is safe to modify without affecting the original.
AtName returns a copied expression with a new attribute or block name step at the end. The returned path is safe to modify without affecting the original.
AtParent returns a copied expression with a new parent step at the end. The returned path is safe to modify without affecting the original.
AtSetValue returns a copied expression with a new set value step at the end. The returned path is safe to modify without affecting the original.
Copy returns a duplicate of the expression that is safe to modify without affecting the original.
Equal returns true if the given expression is exactly equivalent.
Matches returns true if the given Path is valid for the Expression. Any relative expression steps, such as ExpressionStepParent, are automatically resolved before matching.
MatchesParent returns true if the given Path is a valid parent for the Expression. This is helpful for determining if a child Path would potentially match the full Expression during depth-first traversal. Any relative expression steps, such as ExpressionStepParent, are automatically resolved before matching.
Merge returns a copied expression either with the steps of the given expression added to the end of the existing steps, or overwriting the steps if the given expression was a root expression.
Any merged expressions will preserve all expressions steps, such as ExpressionStepParent, for troubleshooting. Methods such as Matches() will automatically resolve the expression when using it. Call the Resolve() method explicitly if a resolved expression without any ExpressionStepParent is desired.
MergeExpressions returns collection of expressions that calls Merge() on the current expression with each of the others.
If no Expression are given, then it will return a collection of expressions containing only the current expression.
Resolve returns a copied expression with any relative steps, such as ExpressionStepParent, resolved. This is not necessary before calling methods such as Matches(), however it can be useful before returning the String() method so the path information is simplified.
Returns an empty expression if any ExpressionStepParent attempt to go beyond the first element.
Steps returns a copy of the underlying expression steps. Returns an empty collection of steps if expression is nil.
String returns the human-readable representation of the path. It is intended for logging and error messages and is not protected by compatibility guarantees.
ExpressionStep represents an expression of an attribute path step, which may match zero, one, or more actual paths.
type ExpressionStepAttributeNameExact string
ExpressionStepAttributeNameExact is an attribute path expression for an exact attribute name match within an object.
Equal returns true if the given ExpressionStep is a ExpressionStepAttributeNameExact and the attribute name is equivalent.
Matches returns true if the given PathStep is fulfilled by the ExpressionStepAttributeNameExact condition.
String returns the human-readable representation of the attribute name expression. It is intended for logging and error messages and is not protected by compatibility guarantees.
type ExpressionStepElementKeyIntAny struct{}
ExpressionStepElementKeyIntAny is an attribute path expression for a matching any integer element key within a list.
Equal returns true if the given ExpressionStep is a ExpressionStepElementKeyIntAny.
Matches returns true if the given PathStep is fulfilled by the ExpressionStepElementKeyIntAny condition.
String returns the human-readable representation of the element key expression. It is intended for logging and error messages and is not protected by compatibility guarantees.
type ExpressionStepElementKeyIntExact int64
ExpressionStepElementKeyIntExact is an attribute path expression for an exact integer element key match within a list. List indexing starts at 0.
Equal returns true if the given ExpressionStep is a ExpressionStepElementKeyIntExact and the integer element key is equivalent.
Matches returns true if the given PathStep is fulfilled by the ExpressionStepElementKeyIntExact condition.
String returns the human-readable representation of the element key expression. It is intended for logging and error messages and is not protected by compatibility guarantees.
type ExpressionStepElementKeyStringAny struct{}
ExpressionStepElementKeyStringAny is an attribute path expression for a matching any string key within a map.
Equal returns true if the given ExpressionStep is a ExpressionStepElementKeyStringAny.
Matches returns true if the given PathStep is fulfilled by the ExpressionStepElementKeyStringAny condition.
String returns the human-readable representation of the element key expression. It is intended for logging and error messages and is not protected by compatibility guarantees.
type ExpressionStepElementKeyStringExact string
ExpressionStepElementKeyStringExact is an attribute path expression for an exact string key within a map. Map keys are always strings.
Equal returns true if the given ExpressionStep is a ExpressionStepElementKeyStringExact and the string element key is equivalent.
Matches returns true if the given PathStep is fulfilled by the ExpressionStepElementKeyStringExact condition.
String returns the human-readable representation of the element key expression. It is intended for logging and error messages and is not protected by compatibility guarantees.
type ExpressionStepElementKeyValueAny struct{}
ExpressionStepElementKeyValueAny is an attribute path expression for a matching any Value element within a set.
Equal returns true if the given ExpressionStep is a ExpressionStepElementKeyValueAny.
Matches returns true if the given PathStep is fulfilled by the ExpressionStepElementKeyValueAny condition.
String returns the human-readable representation of the element key expression. It is intended for logging and error messages and is not protected by compatibility guarantees.
type ExpressionStepElementKeyValueExact struct { attr.Value }
ExpressionStepElementKeyValueExact is an attribute path expression for an exact Value element within a set. Sets do not use integer-based indexing.
Equal returns true if the given ExpressionStep is a ExpressionStepElementKeyValueExact and the Value element key is equivalent.
Matches returns true if the given PathStep is fulfilled by the ExpressionStepElementKeyValueExact condition.
String returns the human-readable representation of the element key expression. It is intended for logging and error messages and is not protected by compatibility guarantees.
type ExpressionStepParent struct{}
StepParent is an attribute path expression for a traversing to the parent attribute path relative to the current one. This is intended only for the start of attribute-level expressions which will be combined with the current attribute path being called.
Equal returns true if the given ExpressionStep is a ExpressionStepParent.
Matches returns true if the given PathStep is fulfilled by the ExpressionStepParent condition.
String returns the human-readable representation of the element key expression. It is intended for logging and error messages and is not protected by compatibility guarantees.
ExpressionSteps represents an ordered collection of attribute path expressions.
Append adds the given ExpressionSteps to the end of the previous ExpressionSteps and returns the combined result.
Copy returns a duplicate of the steps that is safe to modify without affecting the original. Returns nil if the original steps is nil.
Equal returns true if the given ExpressionSteps are equivalent.
LastStep returns the final ExpressionStep and the remaining ExpressionSteps.
Matches returns true if the given PathSteps match each ExpressionStep.
Any ExpressionStepParent will automatically be resolved.
MatchesParent returns true if the given PathSteps match each ExpressionStep until there are no more PathSteps. This is helpful for determining if the PathSteps would potentially match the full ExpressionSteps during depth-first traversal.
Any ExpressionStepParent will automatically be resolved.
NextStep returns the first ExpressionStep and the remaining ExpressionSteps.
Resolve returns a copy of ExpressionSteps without any ExpressionStepParent.
Returns empty ExpressionSteps if any ExpressionStepParent attempt to go beyond the first element. Returns nil if the original steps is nil.
String returns the human-readable representation of the ExpressionSteps. It is intended for logging and error messages and is not protected by compatibility guarantees.
Expressions is a collection of attribute path expressions.
Refer to the Expression documentation for more details about intended usage.
Append adds the given Expressions to the collection without duplication and returns the combined result.
Contains returns true if the collection of expressions includes the given expression.
Matches returns true if one of the expressions in the collection matches the given path.
String returns the human-readable representation of the expression collection. It is intended for logging and error messages and is not protected by compatibility guarantees.
Empty expressions are skipped.
Path represents exact traversal steps into a schema or schema-based data. These steps always start from the root of the schema, which is an object with zero or more attributes and blocks.
Use the Root() function to create a Path with an initial AtName() step. Path functionality follows a builder pattern, which allows for chaining method calls to construct a full path. The available traversal steps after Path creation are:
For example, to represent the first list element with a root list attribute named "some_attribute":
path.MatchRoot("some_attribute").AtListIndex(0)
Path is used for functionality which must exactly match the underlying schema structure and types, such as diagnostics that are intended for a specific attribute or working with specific attribute values in a schema based data structure such as tfsdk.Config, tfsdk.Plan, or tfsdk.State.
Refer to Expression for situations where relative or wildcard step logic is desirable for schema defined functionality, such as attribute validators or attribute plan modifiers.
Empty creates an empty attribute path. Provider code should use Root.
Root creates an attribute path starting with a PathStepAttributeName.
AtListIndex returns a copied path with a new list index step at the end. The returned path is safe to modify without affecting the original.
List indices are 0-based. The first element of a list is 0.
AtMapKey returns a copied path with a new map key step at the end. The returned path is safe to modify without affecting the original.
AtName returns a copied path with a new attribute or block name step at the end. The returned path is safe to modify without affecting the original.
AtSetValue returns a copied path with a new set value step at the end. The returned path is safe to modify without affecting the original.
AtTupleIndex returns a copied path with a new tuple index step at the end. The returned path is safe to modify without affecting the original.
Tuple indices are 0-based. The first element of a tuple is 0.
Copy returns a duplicate of the path that is safe to modify without affecting the original.
Equal returns true if the given path is exactly equivalent.
Expression returns an Expression which exactly matches the Path.
ParentPath returns a copy of the path with the last step removed.
If the current path is empty, an empty path is returned.
Steps returns a copy of the underlying path steps. Returns an empty collection of steps if path is nil.
String returns the human-readable representation of the path. It is intended for logging and error messages and is not protected by compatibility guarantees.
PathStep represents a transversal for an attribute path. Only exact path transversals are supported as implementations of this interface must remain compatible with all protocol implementations.
type PathStepAttributeName string
PathStepAttributeName is an attribute path tranversal for an attribute name within an object.
List elements must be transversed by PathStepElementKeyInt. Map elements must be transversed by PathStepElementKeyString. Set elements must be transversed by PathStepElementKeyValue.
Equal returns true if the given PathStep is a PathStepAttributeName and the attribute name is equivalent.
ExpressionStep returns the ExpressionStep for the PathStep.
String returns the human-readable representation of the attribute name. It is intended for logging and error messages and is not protected by compatibility guarantees.
type PathStepElementKeyInt int64
PathStepElementKeyInt is an attribute path transversal for an integer element of a list. List indexing starts a 0.
Map elements must be transversed by PathStepElementKeyString. Object attributes must be transversed by PathStepAttributeName. Set elements must be transversed by PathStepElementKeyValue.
Equal returns true if the given PathStep is a PathStepAttributeName and the attribute name is equivalent.
ExpressionStep returns the ExpressionStep for the PathStep.
String returns the human-readable representation of the element key. It is intended for logging and error messages and is not protected by compatibility guarantees.
type PathStepElementKeyString string
PathStepElementKeyString is an attribute path transversal for a string key of a map. Map keys are always strings.
List elements must be transversed by PathStepElementKeyInt. Object attributes must be transversed by PathStepAttributeName. Set elements must be transversed by PathStepElementKeyValue.
Equal returns true if the given PathStep is a PathStepAttributeName and the attribute name is equivalent.
ExpressionStep returns the ExpressionStep for the PathStep.
String returns the human-readable representation of the element key. It is intended for logging and error messages and is not protected by compatibility guarantees.
type PathStepElementKeyValue struct { attr.Value }
PathStepElementKeyValue is an attribute path transversal for a Value element of a set. Sets do not use integer-based indexing.
List elements must be transversed by PathStepElementKeyInt. Map elements must be transversed by PathStepElementKeyString. Object attributes must be transversed by PathStepAttributeName.
Equal returns true if the given PathStep is a PathStepAttributeName and the attribute name is equivalent.
ExpressionStep returns the ExpressionStep for the PathStep.
String returns the human-readable representation of the element key. It is intended for logging and error messages and is not protected by compatibility guarantees.
PathSteps represents an ordered collection of attribute path transversals.
Append adds the given PathSteps to the end of the previous PathSteps and returns the combined result.
Copy returns a duplicate of the steps that is safe to modify without affecting the original. Returns nil if the original steps is nil.
Equal returns true if the given PathSteps are equivalent.
ExpressionSteps returns the ordered collection of expression steps which exactly matches the PathSteps.
LastStep returns the final PathStep and the remaining PathSteps.
NextStep returns the first PathStep and the remaining PathSteps.
String returns the human-readable representation of the PathSteps. It is intended for logging and error messages and is not protected by compatibility guarantees.
Paths is a collection of exact attribute paths.
Refer to the Path documentation for more details about intended usage.
Append adds the given Paths to the collection without duplication and returns the combined result.
Contains returns true if the collection of paths includes the given path.
String returns the human-readable representation of the path collection. It is intended for logging and error messages and is not protected by compatibility guarantees.
Empty paths are skipped.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4