mirror of
https://github.com/gonum/gonum.git
synced 2025-10-06 15:47:01 +08:00
graph/encoding/graphql: note requirement of dst parameter
The spanning tree walk sets nodes' IDs using the SetIDFromString method so note that nodes returned by the destination's NewNode method must satisfy StringIDSetter.
This commit is contained in:
@@ -17,7 +17,8 @@ import (
|
||||
// Unmarshal parses the JSON-encoded data and stores the result in dst.
|
||||
// Node IDs are obtained from the JSON fields identified by the uid parameter.
|
||||
// UIDs obtained from the JSON encoding must map to unique node ID values
|
||||
// consistently across the JSON-encoded spanning tree.
|
||||
// consistently across the JSON-encoded spanning tree. graph.Node values
|
||||
// returned by dst.NewNode must satisfy StringIDSetter.
|
||||
func Unmarshal(data []byte, uid string, dst encoding.Builder) error {
|
||||
if uid == "" {
|
||||
return errors.New("graphql: invalid UID field name")
|
||||
|
Reference in New Issue
Block a user