Pop the latest entry off the path. pb.Push("foo") // foo pb.PushIndex(1) // foo[1] pb.Push("bar") // foo[1].bar pb.Pop() // foo[1] pb.Pop() // foo
()
| 107 | // pb.Pop() // foo[1] |
| 108 | // pb.Pop() // foo |
| 109 | func (b *PathBuffer) Pop() { |
| 110 | for b.off > 0 { |
| 111 | b.off-- |
| 112 | if b.buf[b.off] == '.' || b.buf[b.off] == '[' { |
| 113 | break |
| 114 | } |
| 115 | } |
| 116 | b.buf = b.buf[:b.off] |
| 117 | } |
| 118 | |
| 119 | // With is shorthand for push, convert to string, and pop. This is useful |
| 120 | // when you want the location of a field given a path buffer as a prefix. |
no outgoing calls
no test coverage detected