93
94// String converts all cyphers and command calls into single long string.
95// Is not really suitable for Cypher shell, but can be used for debug print.
96func (e ExecutionSteps) String() string { 97 s := strings.Builder{}
98 for _, v := range e {
99 switch {
81}
82
83// AddCommand adds command with parameters to step list.
84func (e *ExecutionSteps) AddCommand(args []string) { 85 if len(args) == 0 {
86 return
87 }
56
57// AddCypher adds all Cyphers into one buffer. If current step is Cypher as well, it is reused.
58// Otherwise new buffer is created.
59func (e *ExecutionSteps) AddCypher(cypher ...string) { 60 if len(cypher) == 0 {
61 return
62 }
50}
51
52// IsEmpty checks if there are steps to do.
53func (e ExecutionSteps) IsEmpty() bool { 54 return len(e) == 0
55}
56
(Go's FAQ)[https://go.dev/doc/faq#methodsonvaluesorpointers] recommends that method receivers should be consistent. If some of the methods of the type must have pointer receivers, the rest should too, so the method set is consistent regardless of how the type is used. This is because value and pointer receivers have different method sets.
package main
type foo struct {
a int
}
func (f foo) a() {}
func (f *foo) b() {
f.a = 10
}
package main
type foo struct {
a int
}
func (f *foo) a() {}
func (f *foo) b() {
f.a = 10
}