forked from hashicorp/terraform-plugin-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpath_step_element_key_string.go
41 lines (32 loc) · 1.3 KB
/
path_step_element_key_string.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package path
import "fmt"
// Ensure PathStepElementKeyString satisfies the PathStep interface.
var _ PathStep = PathStepElementKeyString("")
// 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.
type PathStepElementKeyString string
// Equal returns true if the given PathStep is a PathStepAttributeName and the
// attribute name is equivalent.
func (s PathStepElementKeyString) Equal(o PathStep) bool {
other, ok := o.(PathStepElementKeyString)
if !ok {
return false
}
return string(s) == string(other)
}
// ExpressionStep returns the ExpressionStep for the PathStep.
func (s PathStepElementKeyString) ExpressionStep() ExpressionStep {
return ExpressionStepElementKeyStringExact(s)
}
// 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.
func (s PathStepElementKeyString) String() string {
return fmt.Sprintf("[%q]", string(s))
}
// unexported satisfies the PathStep interface.
func (s PathStepElementKeyString) unexported() {}