mirror of
https://github.com/open-cluster-management-io/ocm.git
synced 2026-05-24 01:54:12 +00:00
Some checks failed
Post / coverage (push) Failing after 26m56s
Post / images (amd64) (push) Failing after 6m52s
Post / images (arm64) (push) Failing after 6m50s
Post / image manifest (push) Has been skipped
Post / trigger clusteradm e2e (push) Has been skipped
Close stale issues and PRs / stale (push) Successful in 54s
Scorecard supply-chain security / Scorecard analysis (push) Failing after 1m19s
* Acceping AWS IRSA registraion request Signed-off-by: Gaurav Jaswal <jaswalkiranavtar@gmail.com> * Addressing comments Signed-off-by: Gaurav Jaswal <jaswalkiranavtar@gmail.com> * Addressing comments Signed-off-by: Gaurav Jaswal <jaswalkiranavtar@gmail.com> * Making csr as a default enabled driver if no other driver is explicitly enabled Signed-off-by: Gaurav Jaswal <jaswalkiranavtar@gmail.com> --------- Signed-off-by: Gaurav Jaswal <jaswalkiranavtar@gmail.com> Co-authored-by: “Jeffrey <jeffreywong0417@gmail.com> Co-authored-by: Gaurav Jaswal <jaswalkiranavtar@gmail.com>
54 lines
1.5 KiB
Go
54 lines
1.5 KiB
Go
package xml
|
|
|
|
// mapEntryWrapper is the default member wrapper start element for XML Map entry
|
|
var mapEntryWrapper = StartElement{
|
|
Name: Name{Local: "entry"},
|
|
}
|
|
|
|
// Map represents the encoding of a XML map type
|
|
type Map struct {
|
|
w writer
|
|
scratch *[]byte
|
|
|
|
// member start element is the map entry wrapper start element
|
|
memberStartElement StartElement
|
|
|
|
// isFlattened returns true if the map is a flattened map
|
|
isFlattened bool
|
|
}
|
|
|
|
// newMap returns a map encoder which sets the default map
|
|
// entry wrapper to `entry`.
|
|
//
|
|
// A map `someMap : {{key:"abc", value:"123"}}` is represented as
|
|
// `<someMap><entry><key>abc<key><value>123</value></entry></someMap>`.
|
|
func newMap(w writer, scratch *[]byte) *Map {
|
|
return &Map{
|
|
w: w,
|
|
scratch: scratch,
|
|
memberStartElement: mapEntryWrapper,
|
|
}
|
|
}
|
|
|
|
// newFlattenedMap returns a map encoder which sets the map
|
|
// entry wrapper to the passed in memberWrapper`.
|
|
//
|
|
// A flattened map `someMap : {{key:"abc", value:"123"}}` is represented as
|
|
// `<someMap><key>abc<key><value>123</value></someMap>`.
|
|
func newFlattenedMap(w writer, scratch *[]byte, memberWrapper StartElement) *Map {
|
|
return &Map{
|
|
w: w,
|
|
scratch: scratch,
|
|
memberStartElement: memberWrapper,
|
|
isFlattened: true,
|
|
}
|
|
}
|
|
|
|
// Entry returns a Value encoder with map's element.
|
|
// It writes the member wrapper start tag for each entry.
|
|
func (m *Map) Entry() Value {
|
|
v := newValue(m.w, m.scratch, m.memberStartElement)
|
|
v.isFlattened = m.isFlattened
|
|
return v
|
|
}
|