github.com/quay/claircore@v1.5.28/datastore/postgres/digest.go (about) 1 package postgres 2 3 import ( 4 "github.com/jackc/pgtype" 5 6 "github.com/quay/claircore" 7 ) 8 9 // DigestSlice is a helper to avoid excess intermediate allocations when 10 // handling a slice of Digests. 11 type digestSlice []claircore.Digest 12 13 func (s digestSlice) EncodeText(_ *pgtype.ConnInfo, buf []byte) ([]byte, error) { 14 buf = append(buf, '{') 15 for i, d := range s { 16 if i != 0 { 17 buf = append(buf, ',') 18 } 19 buf = append(buf, '"') 20 buf = append(buf, d.String()...) 21 buf = append(buf, '"') 22 } 23 buf = append(buf, '}') 24 return buf, nil 25 }