Documentation
¶
Overview ¶
Package ctymarks contains some ancillary types, values, and constants for use with mark-related parts of the main cty package.
Index ¶
Constants ¶
const WrangleDrop = simpleWrangleAction('d')
WrangleDrop is a WrangleAction that indicates that the given mark should be dropped at the given path, and that no subsequent wrangle functions in the same operation should be given an opportunity to visit the same mark.
const WrangleExpand = simpleWrangleAction('e')
WrangleExpand is a WrangleAction that indicates that the given mark should be transferred to the top-level value that the current mark wrangling process is operating on.
This effectively means that the mark then applies to all parts of the original top-level value, rather than to only a small part of the nested data structure within it.
const WrangleKeep = simpleWrangleAction('k')
WrangleKeep is a WrangleAction that indicates that the given mark should be retained at the given path and that no subsequent wrangle functions in the same operation should be given an opportunity to visit the same mark.
Variables ¶
This section is empty.
Functions ¶
func WrangleReplaceMark ¶
func WrangleReplaceMark(action WrangleAction) any
WrangleReplaceMark returns the new mark for the given action if it was created using WrangleReplace, or nil if it is any other kind of action.
Types ¶
type WrangleAction ¶
type WrangleAction interface {
// contains filtered or unexported methods
}
WrangleAction values each describe an action to be taken for a particular mark at a particular path that has been visited by a [WrangleFunc].
A nil value of this type represents taking no action at all, and thereby potentially allowing other later functions to decide an action instead.
func WrangleReplace ¶
func WrangleReplace(newMark any) WrangleAction
WrangleReplace returns a WrangleAction that indicates that the given mark should be removed and the given mark inserted in its place.
This could be useful when values must cross between systems that use different marks to represent similar concepts, for example.