With is shorthand for push, convert to string, and pop. This is useful when you want the location of a field given a path buffer as a prefix. pb.Push("foo") pb.With("bar") // returns foo.bar
(s string)
| 122 | // pb.Push("foo") |
| 123 | // pb.With("bar") // returns foo.bar |
| 124 | func (b *PathBuffer) With(s string) string { |
| 125 | b.Push(s) |
| 126 | tmp := b.String() |
| 127 | b.Pop() |
| 128 | return tmp |
| 129 | } |
| 130 | |
| 131 | // WithIndex is short for push index, convert to string, and pop. This is useful |
| 132 | // when you want the location of the index given a path buffer as a prefix. |