MCPcopy Create free account
hub / github.com/despiteallobjections/amigo / insert

Method insert

types/objset.go:21–31  ·  view source on GitHub ↗

initialized lazily insert attempts to insert an object obj into objset s. If s already contains an alternative object alt with the same name, insert leaves s unchanged and returns alt. Otherwise it inserts obj and returns nil.

(obj Object)

Source from the content-addressed store, hash-verified

19// the same name, insert leaves s unchanged and returns alt.
20// Otherwise it inserts obj and returns nil.
21func (s *objset) insert(obj Object) Object {
22 id := obj.Id()
23 if alt := (*s)[id]; alt != nil {
24 return alt
25 }
26 if *s == nil {
27 *s = make(map[string]Object)
28 }
29 (*s)[id] = obj
30 return nil
31}

Callers 3

computeInterfaceTypeSetFunction · 0.95
NewStructFunction · 0.95
collectMethodsMethod · 0.95

Calls 1

IdMethod · 0.65

Tested by

no test coverage detected