MCPcopy Create free account
hub / github.com/pace/bricks / marshalOne

Function marshalOne

http/jsonapi/response.go:138–150  ·  view source on GitHub ↗

marshalOne does the same as MarshalOnePayload except it just returns the payload and doesn't write out results. Useful is you use your JSON rendering library.

(model interface{})

Source from the content-addressed store, hash-verified

136// payload and doesn't write out results. Useful is you use your JSON rendering
137// library.
138func marshalOne(model interface{}) (*OnePayload, error) {
139 included := make(map[string]*Node)
140
141 rootNode, err := visitModelNode(model, &included, true)
142 if err != nil {
143 return nil, err
144 }
145 payload := &OnePayload{Data: rootNode}
146
147 payload.Included = nodeMapValues(&included)
148
149 return payload, nil
150}
151
152// marshalMany does the same as MarshalManyPayload except it just returns the
153// payload and doesn't write out results. Useful is you use your JSON rendering

Callers 1

MarshalFunction · 0.85

Calls 2

visitModelNodeFunction · 0.85
nodeMapValuesFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…