MCPcopy Create free account
hub / github.com/go-pg/pg / TestAnonymousStructField

Function TestAnonymousStructField

db_test.go:158–173  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

156}
157
158func TestAnonymousStructField(t *testing.T) {
159 type MyInt struct{ int }
160
161 type MyStruct struct {
162 Ints []MyInt `pg:",array"`
163 }
164
165 db := testDB()
166
167 var st MyStruct
168 _, err := db.Query(&st, "SELECT ARRAY[1,2,3,4] AS ints")
169 Expect(err).ToNot(BeNil())
170 if !strings.Contains(err.Error(), "json: cannot unmarshal") {
171 t.Fatal(err)
172 }
173}
174
175func TestContextCanceled(t *testing.T) {
176 db := testDB()

Callers

nothing calls this directly

Calls 3

testDBFunction · 0.85
QueryMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…