MCPcopy Create free account
hub / github.com/RedisGraph/redisgraph-go / Encode

Method Encode

node.go:56–80  ·  view source on GitHub ↗

String makes Node satisfy the Stringer interface.

()

Source from the content-addressed store, hash-verified

54
55// String makes Node satisfy the Stringer interface.
56func (n Node) Encode() string {
57 s := []string{"("}
58
59 if n.Alias != "" {
60 s = append(s, n.Alias)
61 }
62
63 if n.Label != "" {
64 s = append(s, ":", n.Label)
65 }
66
67 if len(n.Properties) > 0 {
68 p := make([]string, 0, len(n.Properties))
69 for k, v := range n.Properties {
70 p = append(p, fmt.Sprintf("%s:%v", k, ToString(v)))
71 }
72
73 s = append(s, "{")
74 s = append(s, strings.Join(p, ","))
75 s = append(s, "}")
76 }
77
78 s = append(s, ")")
79 return strings.Join(s, "")
80}

Callers 1

CommitMethod · 0.45

Calls 1

ToStringFunction · 0.85

Tested by

no test coverage detected