Debian Codegraph @

cty/marks.go

raw symbols SCIP
1 package ctyscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/
2
3 import (
4 "fmtscip-go gomod github.com/golang/go/src go1.18 fmt/"
5 "stringsscip-go gomod github.com/golang/go/src go1.18 strings/"
6 )
7
8 // marker is an internal wrapper type used to add special "marks" to values.
9 //
10 // A "mark" is an annotation that can be used to represent additional
11 // characteristics of values that propagate through operation methods to
12 // result values. However, a marked value cannot be used with integration
13 // methods normally associated with its type, in order to ensure that
14 // calling applications don't inadvertently drop marks as they round-trip
15 // values out of cty and back in again.
16 //
17 // Marked values are created only explicitly by the calling application, so
18 // an application that never marks a value does not need to worry about
19 // encountering marked values.
20 type markerscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/marker# struct {
21 realVscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/marker#realV. interface{}
22 marksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/marker#marks. ValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ValueMarks#
23 }
24
25 // ValueMarks is a map, representing a set, of "mark" values associated with
26 // a Value. See Value.Mark for more information on the usage of mark values.
27 type ValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ValueMarks# map[interface{}]struct{}
28
29 // NewValueMarks constructs a new ValueMarks set with the given mark values.
30 //
31 // If any of the arguments are already ValueMarks values then they'll be merged
32 // into the result, rather than used directly as individual marks.
33 func NewValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/NewValueMarks().(marks ...interface{}) ValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ValueMarks# {
34 if len(marks) == 0 {
35 return nil
36 }
37 ret := make(ValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ValueMarks#, len(marks))
38 for _, v := range marks {
39 if vm, ok := v.(ValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ValueMarks#); ok {
40 // Constructing a new ValueMarks with an existing ValueMarks
41 // implements a merge operation. (This can cause our result to
42 // have a larger size than we expected, but that's okay.)
43 for v := range vm {
44 ret[v] = struct{}{}
45 }
46 continue
47 }
48 ret[v] = struct{}{}
49 }
50 if len(ret) == 0 {
51 // If we were merging ValueMarks values together and they were all
52 // empty then we'll avoid returning a zero-length map and return a
53 // nil instead, as is conventional.
54 return nil
55 }
56 return ret
57 }
58
59 // Equal returns true if the receiver and the given ValueMarks both contain
60 // the same marks.
61 func (m ValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ValueMarks#) Equalscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ValueMarks#Equal().(o ValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ValueMarks#) bool {
62 if len(m) != len(o) {
63 return false
64 }
65 for v := range m {
66 if _, ok := o[v]; !ok {
67 return false
68 }
69 }
70 return true
71 }
72
73 func (m ValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ValueMarks#) GoStringscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ValueMarks#GoString().() string {
74 var s stringsscip-go gomod github.com/golang/go/src go1.18 strings/.Builderscip-go gomod github.com/golang/go/src go1.18 strings/Builder#
75 s.WriteStringscip-go gomod github.com/golang/go/src go1.18 strings/Builder#WriteString().("cty.NewValueMarks(")
76 i := 0
77 for mv := range m {
78 if i != 0 {
79 s.WriteStringscip-go gomod github.com/golang/go/src go1.18 strings/Builder#WriteString().(", ")
80 }
81 s.WriteStringscip-go gomod github.com/golang/go/src go1.18 strings/Builder#WriteString().(fmtscip-go gomod github.com/golang/go/src go1.18 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.18 fmt/Sprintf().("%#v", mv))
82 i++
83 }
84 s.WriteStringscip-go gomod github.com/golang/go/src go1.18 strings/Builder#WriteString().(")")
85 return s.Stringscip-go gomod github.com/golang/go/src go1.18 strings/Builder#String().()
86 }
87
88 // PathValueMarks is a structure that enables tracking marks
89 // and the paths where they are located in one type
90 type PathValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/PathValueMarks# struct {
91 Pathscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/PathValueMarks#Path. Pathscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Path#
92 Marksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/PathValueMarks#Marks. ValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ValueMarks#
93 }
94
95 func (p PathValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/PathValueMarks#) Equalscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/PathValueMarks#Equal().(o PathValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/PathValueMarks#) bool {
96 if !p.Pathscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/PathValueMarks#Path..Equalsscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Path#Equals().(o.Pathscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/PathValueMarks#Path.) {
97 return false
98 }
99 if !p.Marksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/PathValueMarks#Marks..Equalscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ValueMarks#Equal().(o.Marksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/PathValueMarks#Marks.) {
100 return false
101 }
102 return true
103 }
104
105 // IsMarked returns true if and only if the receiving value carries at least
106 // one mark. A marked value cannot be used directly with integration methods
107 // without explicitly unmarking it (and retrieving the markings) first.
108 func (val Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#) IsMarkedscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#IsMarked().() bool {
109 _, ok := val.vscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#v..(markerscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/marker#)
110 return ok
111 }
112
113 // HasMark returns true if and only if the receiving value has the given mark.
114 func (val Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#) HasMarkscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#HasMark().(mark interface{}) bool {
115 if mr, ok := val.vscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#v..(markerscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/marker#); ok {
116 _, ok := mr.marksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/marker#marks.[mark]
117 return ok
118 }
119 return false
120 }
121
122 // ContainsMarked returns true if the receiving value or any value within it
123 // is marked.
124 //
125 // This operation is relatively expensive. If you only need a shallow result,
126 // use IsMarked instead.
127 func (val Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#) ContainsMarkedscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#ContainsMarked().() bool {
128 ret := false
129 Walkscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Walk().(val, func(_ Pathscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Path#, v Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#) (bool, error) {
130 if v.IsMarkedscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#IsMarked().() {
131 ret = true
132 return false, nil
133 }
134 return true, nil
135 })
136 return ret
137 }
138
139 func (val Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#) assertUnmarkedscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#assertUnmarked().() {
140 if val.IsMarkedscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#IsMarked().() {
141 panic("value is marked, so must be unmarked first")
142 }
143 }
144
145 // Marks returns a map (representing a set) of all of the mark values
146 // associated with the receiving value, without changing the marks. Returns nil
147 // if the value is not marked at all.
148 func (val Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#) Marksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Marks().() ValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ValueMarks# {
149 if mr, ok := val.vscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#v..(markerscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/marker#); ok {
150 // copy so that the caller can't mutate our internals
151 ret := make(ValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ValueMarks#, len(mr.marksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/marker#marks.))
152 for k, v := range mr.marksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/marker#marks. {
153 ret[k] = v
154 }
155 return ret
156 }
157 return nil
158 }
159
160 // HasSameMarks returns true if an only if the receiver and the given other
161 // value have identical marks.
162 func (val Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#) HasSameMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#HasSameMarks().(other Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#) bool {
163 vm, vmOK := val.vscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#v..(markerscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/marker#)
164 om, omOK := other.vscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#v..(markerscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/marker#)
165 if vmOK != omOK {
166 return false
167 }
168 if vmOK {
169 return vm.marksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/marker#marks..Equalscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ValueMarks#Equal().(om.marksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/marker#marks.)
170 }
171 return true
172 }
173
174 // Mark returns a new value that as the same type and underlying value as
175 // the receiver but that also carries the given value as a "mark".
176 //
177 // Marks are used to carry additional application-specific characteristics
178 // associated with values. A marked value can be used with operation methods,
179 // in which case the marks are propagated to the operation results. A marked
180 // value _cannot_ be used with integration methods, so callers of those
181 // must derive an unmarked value using Unmark (and thus explicitly handle
182 // the markings) before calling the integration methods.
183 //
184 // The mark value can be any value that would be valid to use as a map key.
185 // The mark value should be of a named type in order to use the type itself
186 // as a namespace for markings. That type can be unexported if desired, in
187 // order to ensure that the mark can only be handled through the defining
188 // package's own functions.
189 //
190 // An application that never calls this method does not need to worry about
191 // handling marked values.
192 func (val Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#) Markscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Mark().(mark interface{}) Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value# {
193 var newMarker markerscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/marker#
194 newMarker.realVscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/marker#realV. = val.vscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#v.
195 if mr, ok := val.vscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#v..(markerscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/marker#); ok {
196 // It's already a marker, so we'll retain existing marks.
197 newMarker.marksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/marker#marks. = make(ValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ValueMarks#, len(mr.marksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/marker#marks.)+1)
198 for k, v := range mr.marksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/marker#marks. {
199 newMarker.marksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/marker#marks.[k] = v
200 }
201 // unwrap the inner marked value, so we don't get multiple layers
202 // of marking.
203 newMarker.realVscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/marker#realV. = mr.realVscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/marker#realV.
204 } else {
205 // It's not a marker yet, so we're creating the first mark.
206 newMarker.marksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/marker#marks. = make(ValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ValueMarks#, 1)
207 }
208 newMarker.marksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/marker#marks.[mark] = struct{}{}
209 return Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#{
210 tyscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#ty.: val.tyscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#ty.,
211 vscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#v.: newMarker,
212 }
213 }
214
215 type applyPathValueMarksTransformerscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/applyPathValueMarksTransformer# struct {
216 pvmscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/applyPathValueMarksTransformer#pvm. []PathValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/PathValueMarks#
217 }
218
219 func (t *applyPathValueMarksTransformerscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/applyPathValueMarksTransformer#) Enterscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/applyPathValueMarksTransformer#Enter().(p Pathscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Path#, v Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#) (Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#, error) {
220 return v, nil
221 }
222
223 func (t *applyPathValueMarksTransformerscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/applyPathValueMarksTransformer#) Exitscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/applyPathValueMarksTransformer#Exit().(p Pathscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Path#, v Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#) (Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#, error) {
224 for _, path := range t.pvmscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/applyPathValueMarksTransformer#pvm. {
225 if p.Equalsscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Path#Equals().(path.Pathscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/PathValueMarks#Path.) {
226 return v.WithMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#WithMarks().(path.Marksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/PathValueMarks#Marks.), nil
227 }
228 }
229 return v, nil
230 }
231
232 // MarkWithPaths accepts a slice of PathValueMarks to apply
233 // markers to particular paths and returns the marked
234 // Value.
235 func (val Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#) MarkWithPathsscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#MarkWithPaths().(pvm []PathValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/PathValueMarks#) Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value# {
236 ret, _ := TransformWithTransformerscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/TransformWithTransformer().(val, &applyPathValueMarksTransformerscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/applyPathValueMarksTransformer#{pvm})
237 return ret
238 }
239
240 // Unmark separates the marks of the receiving value from the value itself,
241 // removing a new unmarked value and a map (representing a set) of the marks.
242 //
243 // If the receiver isn't marked, Unmark returns it verbatim along with a nil
244 // map of marks.
245 func (val Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#) Unmarkscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Unmark().() (Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#, ValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ValueMarks#) {
246 if !val.IsMarkedscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#IsMarked().() {
247 return val, nil
248 }
249 mr := val.vscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#v..(markerscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/marker#)
250 marks := val.Marksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Marks().() // copy so that the caller can't mutate our internals
251 return Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#{
252 tyscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#ty.: val.tyscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#ty.,
253 vscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#v.: mr.realVscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/marker#realV.,
254 }, marks
255 }
256
257 type unmarkTransformerscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/unmarkTransformer# struct {
258 pvmscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/unmarkTransformer#pvm. []PathValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/PathValueMarks#
259 }
260
261 func (t *unmarkTransformerscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/unmarkTransformer#) Enterscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/unmarkTransformer#Enter().(p Pathscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Path#, v Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#) (Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#, error) {
262 unmarkedVal, marks := v.Unmarkscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Unmark().()
263 if len(marks) > 0 {
264 path := make(Pathscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Path#, len(p), len(p)+1)
265 copy(path, p)
266 t.pvmscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/unmarkTransformer#pvm. = append(t.pvmscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/unmarkTransformer#pvm., PathValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/PathValueMarks#{path, marks})
267 }
268 return unmarkedVal, nil
269 }
270
271 func (t *unmarkTransformerscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/unmarkTransformer#) Exitscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/unmarkTransformer#Exit().(p Pathscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Path#, v Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#) (Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#, error) {
272 return v, nil
273 }
274
275 // UnmarkDeep is similar to Unmark, but it works with an entire nested structure
276 // rather than just the given value directly.
277 //
278 // The result is guaranteed to contain no nested values that are marked, and
279 // the returned marks set includes the superset of all of the marks encountered
280 // during the operation.
281 func (val Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#) UnmarkDeepscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#UnmarkDeep().() (Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#, ValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ValueMarks#) {
282 t := unmarkTransformerscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/unmarkTransformer#{}
283 ret, _ := TransformWithTransformerscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/TransformWithTransformer().(val, &t)
284
285 marks := make(ValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ValueMarks#)
286 for _, pvm := range t.pvmscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/unmarkTransformer#pvm. {
287 for m, s := range pvm.Marksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/PathValueMarks#Marks. {
288 marks[m] = s
289 }
290 }
291
292 return ret, marks
293 }
294
295 // UnmarkDeepWithPaths is like UnmarkDeep, except it returns a slice
296 // of PathValueMarks rather than a superset of all marks. This allows
297 // a caller to know which marks are associated with which paths
298 // in the Value.
299 func (val Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#) UnmarkDeepWithPathsscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#UnmarkDeepWithPaths().() (Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#, []PathValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/PathValueMarks#) {
300 t := unmarkTransformerscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/unmarkTransformer#{}
301 ret, _ := TransformWithTransformerscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/TransformWithTransformer().(val, &t)
302 return ret, t.pvmscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/unmarkTransformer#pvm.
303 }
304
305 func (val Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#) unmarkForcescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#unmarkForce().() Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value# {
306 unw, _ := val.Unmarkscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Unmark().()
307 return unw
308 }
309
310 // WithMarks returns a new value that has the same type and underlying value
311 // as the receiver and also has the marks from the given maps (representing
312 // sets).
313 func (val Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#) WithMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#WithMarks().(marks ...ValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ValueMarks#) Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value# {
314 if len(marks) == 0 {
315 return val
316 }
317 ownMarks := val.Marksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Marks().()
318 markCount := len(ownMarks)
319 for _, s := range marks {
320 markCount += len(s)
321 }
322 if markCount == 0 {
323 return val
324 }
325 newMarks := make(ValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ValueMarks#, markCount)
326 for m := range ownMarks {
327 newMarks[m] = struct{}{}
328 }
329 for _, s := range marks {
330 for m := range s {
331 newMarks[m] = struct{}{}
332 }
333 }
334 v := val.vscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#v.
335 if mr, ok := v.(markerscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/marker#); ok {
336 v = mr.realVscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/marker#realV.
337 }
338 return Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#{
339 tyscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#ty.: val.tyscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#ty.,
340 vscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#v.: markerscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/marker#{
341 realVscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/marker#realV.: v,
342 marksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/marker#marks.: newMarks,
343 },
344 }
345 }
346
347 // WithSameMarks returns a new value that has the same type and underlying
348 // value as the receiver and also has the marks from the given source values.
349 //
350 // Use this if you are implementing your own higher-level operations against
351 // cty using the integration methods, to re-introduce the marks from the
352 // source values of the operation.
353 func (val Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#) WithSameMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#WithSameMarks().(srcs ...Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#) Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value# {
354 if len(srcs) == 0 {
355 return val
356 }
357 ownMarks := val.Marksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#Marks().()
358 markCount := len(ownMarks)
359 for _, sv := range srcs {
360 if mr, ok := sv.vscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#v..(markerscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/marker#); ok {
361 markCount += len(mr.marksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/marker#marks.)
362 }
363 }
364 if markCount == 0 {
365 return val
366 }
367 newMarks := make(ValueMarksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/ValueMarks#, markCount)
368 for m := range ownMarks {
369 newMarks[m] = struct{}{}
370 }
371 for _, sv := range srcs {
372 if mr, ok := sv.vscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#v..(markerscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/marker#); ok {
373 for m := range mr.marksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/marker#marks. {
374 newMarks[m] = struct{}{}
375 }
376 }
377 }
378 v := val.vscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#v.
379 if mr, ok := v.(markerscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/marker#); ok {
380 v = mr.realVscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/marker#realV.
381 }
382 return Valuescip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#{
383 tyscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#ty.: val.tyscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#ty.,
384 vscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/Value#v.: markerscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/marker#{
385 realVscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/marker#realV.: v,
386 marksscip-go gomod github.com/zclconf/go-cty . `github.com/zclconf/go-cty/cty`/marker#marks.: newMarks,
387 },
388 }
389 }