Documentation
¶
Index ¶
- Variables
- func EscapeText(s string) string
- func RemoveDuplicates[T Nameable, S ~[]T](slice *S)
- func Tidy(t Tidyable, path metadata.MetadataFilePath) error
- type BooleanText
- type IntegerText
- type Metadata
- type Nameable
- type NillableText
- type TextLiteral
- func (t TextLiteral) MarshalXML(e *xml.Encoder, start xml.StartElement) error
- func (t *TextLiteral) Reformat(format func(string) (string, error)) error
- func (t *TextLiteral) Set(value string)
- func (t *TextLiteral) String() string
- func (t *TextLiteral) UnmarshalXML(d *nbioxml.Decoder, start nbioxml.StartElement) error
- type Tidyable
- type TranslationText
- type TypedText
Constants ¶
This section is empty.
Variables ¶
var FalseText = BooleanText{
Text: "false",
}
var TrueText = BooleanText{
Text: "true",
}
Functions ¶
func EscapeText ¶ added in v0.75.0
EscapeText returns s escaped for use as the inner XML of an element, with the entity references Salesforce writes in metadata.
func RemoveDuplicates ¶
func RemoveDuplicates[T Nameable, S ~[]T](slice *S)
Types ¶
type BooleanText ¶
type BooleanText struct {
Text string `xml:",chardata"`
}
func BooleanTextValue ¶
func BooleanTextValue(cmd *cobra.Command, flag string) (t *BooleanText)
func (*BooleanText) IsFalse ¶
func (b *BooleanText) IsFalse() bool
func (*BooleanText) IsTrue ¶
func (b *BooleanText) IsTrue() bool
func (BooleanText) MarshalXML ¶
func (b BooleanText) MarshalXML(e *xml.Encoder, start xml.StartElement) error
func (*BooleanText) String ¶
func (b *BooleanText) String() string
func (*BooleanText) ToBool ¶
func (b *BooleanText) ToBool() bool
type IntegerText ¶
type IntegerText struct {
Text string `xml:",chardata"`
}
func IntegerValue ¶
func IntegerValue(cmd *cobra.Command, flag string) (t *IntegerText)
type Metadata ¶
type Metadata = metadata.MetadataPointer
type NillableText ¶ added in v0.69.0
type NillableText struct {
TextLiteral
Nil string
}
NillableText is an element written as <name xsi:nil="true"/> when it has no value. The root element of the metadata declares the xsi namespace.
func (NillableText) MarshalXML ¶ added in v0.75.0
func (t NillableText) MarshalXML(e *xml.Encoder, start xml.StartElement) error
func (*NillableText) UnmarshalXML ¶ added in v0.75.0
func (t *NillableText) UnmarshalXML(d *nbioxml.Decoder, start nbioxml.StartElement) error
type TextLiteral ¶
type TextLiteral struct {
// contains filtered or unexported fields
}
TextLiteral is the text of an element. It holds the element's character data and the inner XML that encodes it. An element read from metadata is written back with the inner XML it was read with, so a CDATA section stays a CDATA section; text set with NewTextLiteral or Set is written escaped with EscapeText. The inner XML is always well-formed: it is either read by the XML decoder or produced by EscapeText.
UnmarshalXML takes github.com/nbio/xml types because metadata files are parsed with that package, while MarshalXML takes encoding/xml types because they are written with encoding/xml. NillableText and TypedText follow the same rule.
func NewTextLiteral ¶ added in v0.75.0
func NewTextLiteral(value string) *TextLiteral
NewTextLiteral returns a TextLiteral whose character data is value.
func (TextLiteral) MarshalXML ¶ added in v0.75.0
func (t TextLiteral) MarshalXML(e *xml.Encoder, start xml.StartElement) error
func (*TextLiteral) Reformat ¶ added in v0.75.0
func (t *TextLiteral) Reformat(format func(string) (string, error)) error
Reformat replaces the character data of the element with the result of applying format to it. The element is unchanged if format returns an error.
func (*TextLiteral) Set ¶ added in v0.75.0
func (t *TextLiteral) Set(value string)
Set replaces the character data of the element with value.
func (*TextLiteral) String ¶
func (t *TextLiteral) String() string
String returns the character data of the element. A nil TextLiteral has no character data.
func (*TextLiteral) UnmarshalXML ¶ added in v0.75.0
func (t *TextLiteral) UnmarshalXML(d *nbioxml.Decoder, start nbioxml.StartElement) error
type TranslationText ¶ added in v0.60.0
TranslationText is a translated value in a translation file. Text holds the value with XML entities decoded. Salesforce writes a value that has not been translated as an XML comment holding the untranslated text, such as <label><!-- Account Name --></label>. Text is empty for such a value, and Comment holds the comment's content so the value can be written back unchanged.
UnmarshalXML takes github.com/nbio/xml types because metadata files are parsed with that package, while MarshalXML takes encoding/xml types because they are written with encoding/xml.
func (TranslationText) MarshalXML ¶ added in v0.60.0
func (t TranslationText) MarshalXML(e *xml.Encoder, start xml.StartElement) error
func (*TranslationText) UnmarshalXML ¶ added in v0.60.0
func (t *TranslationText) UnmarshalXML(d *nbioxml.Decoder, start nbioxml.StartElement) error
type TypedText ¶ added in v0.75.0
type TypedText struct {
TextLiteral
Type string
Nil string
}
TypedText is a value written with its XML schema type, <value xsi:type="xsd:string">, or as <value xsi:nil="true"/> when it has no value.