()
| 155 | } |
| 156 | |
| 157 | func (p *parseState) parseElement() error { |
| 158 | var next string |
| 159 | var err error |
| 160 | r := p.peek() |
| 161 | switch r { |
| 162 | case '{': |
| 163 | return nestedArraysNotSupportedError |
| 164 | case '"': |
| 165 | p.advance() |
| 166 | next, err = p.parseQuotedString() |
| 167 | if err != nil { |
| 168 | return err |
| 169 | } |
| 170 | p.advance() |
| 171 | default: |
| 172 | if !p.isElementChar(r) { |
| 173 | return malformedError |
| 174 | } |
| 175 | next, err = p.parseUnquotedString() |
| 176 | if err != nil { |
| 177 | return err |
| 178 | } |
| 179 | if strings.EqualFold(next, "null") { |
| 180 | return p.result.Append(DNull) |
| 181 | } |
| 182 | } |
| 183 | |
| 184 | d, dependsOnContext, err := ParseAndRequireString(p.t, next, p.ctx) |
| 185 | if err != nil { |
| 186 | return err |
| 187 | } |
| 188 | if dependsOnContext { |
| 189 | p.dependsOnContext = true |
| 190 | } |
| 191 | return p.result.Append(d) |
| 192 | } |
| 193 | |
| 194 | // ParseDArrayFromString parses the string-form of constructing arrays, handling |
| 195 | // cases such as `'{1,2,3}'::INT[]`. The input type t is the type of the |
no test coverage detected