()
| 125 | } |
| 126 | |
| 127 | func (p *parseState) parseElement() error { |
| 128 | var next string |
| 129 | var err error |
| 130 | r := p.peek() |
| 131 | switch r { |
| 132 | case '{': |
| 133 | return nestedArraysNotSupportedError |
| 134 | case '"': |
| 135 | p.advance() |
| 136 | next, err = p.parseQuotedString() |
| 137 | if err != nil { |
| 138 | return err |
| 139 | } |
| 140 | p.advance() |
| 141 | default: |
| 142 | if !isElementChar(r) { |
| 143 | return malformedError |
| 144 | } |
| 145 | next, err = p.parseUnquotedString() |
| 146 | if err != nil { |
| 147 | return err |
| 148 | } |
| 149 | if strings.EqualFold(next, "null") { |
| 150 | return p.result.Append(DNull) |
| 151 | } |
| 152 | } |
| 153 | |
| 154 | d, dependsOnContext, err := ParseAndRequireString(p.t, next, p.ctx) |
| 155 | if err != nil { |
| 156 | return err |
| 157 | } |
| 158 | if dependsOnContext { |
| 159 | p.dependsOnContext = true |
| 160 | } |
| 161 | return p.result.Append(d) |
| 162 | } |
| 163 | |
| 164 | // ParseDArrayFromString parses the string-form of constructing arrays, handling |
| 165 | // cases such as `'{1,2,3}'::INT[]`. The input type t is the type of the |
no test coverage detected