MCPcopy Create free account
hub / github.com/imgproxy/imgproxy / Set

Method Set

xmlparser/attributes.go:55–71  ·  view source on GitHub ↗

Set sets the value of the attribute with the given name. If the attribute does not exist, it is created.

(name Name, value string)

Source from the content-addressed store, hash-verified

53// Set sets the value of the attribute with the given name.
54// If the attribute does not exist, it is created.
55func (a *Attributes) Set(name Name, value string) {
56 // Initialize the map if it is nil
57 if a.m == nil {
58 a.m = make(map[Name]*Attribute)
59 }
60
61 // If attribute exists, update its value
62 if attr, exists := a.m[name]; exists {
63 attr.Value = value
64 return
65 }
66
67 // Otherwise, create a new attribute
68 attr := &Attribute{Name: name, Value: value}
69 a.m[name] = attr
70 a.s = append(a.s, attr)
71}
72
73// SetByString is like Set but accepts a string name.
74func (a *Attributes) SetByString(name, value string) {

Callers 1

SetByStringMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected