MCPcopy
hub / github.com/jackc/pgx / appendFields

Method appendFields

pgproto3/error_response.go:119–220  ·  view source on GitHub ↗
(dst []byte)

Source from the content-addressed store, hash-verified

117}
118
119func (src *ErrorResponse) appendFields(dst []byte) []byte {
120 if src.Severity != "" {
121 dst = append(dst, 'S')
122 dst = append(dst, src.Severity...)
123 dst = append(dst, 0)
124 }
125 if src.SeverityUnlocalized != "" {
126 dst = append(dst, 'V')
127 dst = append(dst, src.SeverityUnlocalized...)
128 dst = append(dst, 0)
129 }
130 if src.Code != "" {
131 dst = append(dst, 'C')
132 dst = append(dst, src.Code...)
133 dst = append(dst, 0)
134 }
135 if src.Message != "" {
136 dst = append(dst, 'M')
137 dst = append(dst, src.Message...)
138 dst = append(dst, 0)
139 }
140 if src.Detail != "" {
141 dst = append(dst, 'D')
142 dst = append(dst, src.Detail...)
143 dst = append(dst, 0)
144 }
145 if src.Hint != "" {
146 dst = append(dst, 'H')
147 dst = append(dst, src.Hint...)
148 dst = append(dst, 0)
149 }
150 if src.Position != 0 {
151 dst = append(dst, 'P')
152 dst = append(dst, strconv.Itoa(int(src.Position))...)
153 dst = append(dst, 0)
154 }
155 if src.InternalPosition != 0 {
156 dst = append(dst, 'p')
157 dst = append(dst, strconv.Itoa(int(src.InternalPosition))...)
158 dst = append(dst, 0)
159 }
160 if src.InternalQuery != "" {
161 dst = append(dst, 'q')
162 dst = append(dst, src.InternalQuery...)
163 dst = append(dst, 0)
164 }
165 if src.Where != "" {
166 dst = append(dst, 'W')
167 dst = append(dst, src.Where...)
168 dst = append(dst, 0)
169 }
170 if src.SchemaName != "" {
171 dst = append(dst, 's')
172 dst = append(dst, src.SchemaName...)
173 dst = append(dst, 0)
174 }
175 if src.TableName != "" {
176 dst = append(dst, 't')

Callers 2

EncodeMethod · 0.95
EncodeMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected