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

Function ExampleDB_Model_nullEmptyValue

example_model_test.go:521–533  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

519}
520
521func ExampleDB_Model_nullEmptyValue() {
522 type Example struct {
523 Hello string
524 }
525
526 var str sql.NullString
527 _, err := pgdb.QueryOne(pg.Scan(&str), "SELECT ?hello", &Example{Hello: ""})
528 if err != nil {
529 panic(err)
530 }
531 fmt.Println(str.Valid)
532 // Output: false
533}
534
535func ExampleDB_Model_forEach() {
536 err := pgdb.Model((*Book)(nil)).

Callers

nothing calls this directly

Calls 2

QueryOneMethod · 0.65
ScanMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…