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{})
| 136 | // payload and doesn't write out results. Useful is you use your JSON rendering |
| 137 | // library. |
| 138 | func 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 |
no test coverage detected
searching dependent graphs…