MCPcopy Index your code
hub / github.com/aarondl/sqlboiler / Value

Method Value

types/array.go:977–998  ·  view source on GitHub ↗

Value implements the driver.Valuer interface.

()

Source from the content-addressed store, hash-verified

975
976// Value implements the driver.Valuer interface.
977func (a StringArray) Value() (driver.Value, error) {
978 if a == nil {
979 return nil, nil
980 }
981
982 if n := len(a); n > 0 {
983 // There will be at least two curly brackets, 2*N bytes of quotes,
984 // and N-1 bytes of delimiters.
985 b := make([]byte, 1, 1+3*n)
986 b[0] = '{'
987
988 b = appendArrayQuotedBytes(b, []byte(a[0]))
989 for i := 1; i < n; i++ {
990 b = append(b, ',')
991 b = appendArrayQuotedBytes(b, []byte(a[i]))
992 }
993
994 return string(append(b, '}')), nil
995 }
996
997 return "{}", nil
998}
999
1000// Randomize for sqlboiler
1001func (a *StringArray) Randomize(nextInt func() int64, fieldType string, shouldBeNull bool) {

Callers

nothing calls this directly

Calls 1

appendArrayQuotedBytesFunction · 0.85

Tested by

no test coverage detected