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

Function nbaseDigitsToInt64

pgtype/numeric.go:196–210  ·  view source on GitHub ↗
(src []byte)

Source from the content-addressed store, hash-verified

194}
195
196func nbaseDigitsToInt64(src []byte) (accum int64, bytesRead, digitsRead int) {
197 digits := min(len(src)/2, 4)
198
199 rp := 0
200
201 for i := range digits {
202 if i > 0 {
203 accum *= nbase
204 }
205 accum += int64(binary.BigEndian.Uint16(src[rp:]))
206 rp += 2
207 }
208
209 return accum, rp, digits
210}
211
212// Scan implements the [database/sql.Scanner] interface.
213func (n *Numeric) Scan(src any) error {

Callers 1

ScanMethod · 0.85

Calls 1

Uint16Method · 0.80

Tested by

no test coverage detected