MCPcopy Create free account
hub / github.com/uptrace/bun / Array

Function Array

dialect/pgdialect/array.go:30–42  ·  view source on GitHub ↗

Array accepts a slice and returns a wrapper for working with PostgreSQL array data type. For struct fields you can use array tag: Emails []string `bun:",array"`

(vi any)

Source from the content-addressed store, hash-verified

28//
29// Emails []string `bun:",array"`
30func Array(vi any) *ArrayValue {
31 v := reflect.ValueOf(vi)
32 if !v.IsValid() {
33 panic(fmt.Errorf("bun: Array(nil)"))
34 }
35
36 return &ArrayValue{
37 v: v,
38
39 append: pgDialect.arrayAppender(v.Type()),
40 scan: arrayScanner(v.Type()),
41 }
42}
43
44var (
45 _ schema.QueryAppender = (*ArrayValue)(nil)

Callers 8

beforeInsertFixtureFunction · 0.92
TestPostgresArrayFunction · 0.92
TestPostgresArrayQuoteFunction · 0.92
TestPostgresScanUUIDFunction · 0.92
TestPostgresTimeArrayFunction · 0.92
TestPostgresJSONBFunction · 0.92
TestArrayAppendFunction · 0.85

Calls 3

arrayScannerFunction · 0.85
IsValidMethod · 0.80
arrayAppenderMethod · 0.80

Tested by 7

TestPostgresArrayFunction · 0.74
TestPostgresArrayQuoteFunction · 0.74
TestPostgresScanUUIDFunction · 0.74
TestPostgresTimeArrayFunction · 0.74
TestPostgresJSONBFunction · 0.74
TestArrayAppendFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…