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

Function ExampleDB_Model_forEach

example_model_test.go:535–548  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

533}
534
535func ExampleDB_Model_forEach() {
536 err := pgdb.Model((*Book)(nil)).
537 OrderExpr("id ASC").
538 ForEach(func(b *Book) error {
539 fmt.Println(b)
540 return nil
541 })
542 if err != nil {
543 panic(err)
544 }
545 // Output: Book<Id=1 Title="book 1">
546 // Book<Id=2 Title="book 2">
547 // Book<Id=3 Title="book 3">
548}
549
550func ExampleDB_Model_hasOne() {
551 type Profile struct {

Callers

nothing calls this directly

Calls 3

ForEachMethod · 0.80
OrderExprMethod · 0.80
ModelMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…