()
| 110 | } |
| 111 | |
| 112 | func (p *parseState) parseElement() error { |
| 113 | var next string |
| 114 | var err error |
| 115 | r := p.peek() |
| 116 | switch r { |
| 117 | case '{': |
| 118 | return nestedArraysNotSupportedError |
| 119 | case '"': |
| 120 | p.advance() |
| 121 | next, err = p.parseQuotedString() |
| 122 | if err != nil { |
| 123 | return err |
| 124 | } |
| 125 | p.advance() |
| 126 | default: |
| 127 | if !isElementChar(r) { |
| 128 | return malformedError |
| 129 | } |
| 130 | next, err = p.parseUnquotedString() |
| 131 | if err != nil { |
| 132 | return err |
| 133 | } |
| 134 | if strings.EqualFold(next, "null") { |
| 135 | return p.result.Append(DNull) |
| 136 | } |
| 137 | } |
| 138 | |
| 139 | d, err := ParseAndRequireString(p.t, next, p.ctx) |
| 140 | if err != nil { |
| 141 | return err |
| 142 | } |
| 143 | return p.result.Append(d) |
| 144 | } |
| 145 | |
| 146 | // ParseDArrayFromString parses the string-form of constructing arrays, handling |
| 147 | // cases such as `'{1,2,3}'::INT[]`. The input type t is the type of the |
no test coverage detected