Value implements the driver.Valuer interface.
()
| 975 | |
| 976 | // Value implements the driver.Valuer interface. |
| 977 | func (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 |
| 1001 | func (a *StringArray) Randomize(nextInt func() int64, fieldType string, shouldBeNull bool) { |
nothing calls this directly
no test coverage detected