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

Function ExampleDB_Model_selectFirstRow

example_model_test.go:267–277  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

265}
266
267func ExampleDB_Model_selectFirstRow() {
268 db := modelDB()
269
270 var firstBook Book
271 err := db.Model(&firstBook).First()
272 if err != nil {
273 panic(err)
274 }
275 fmt.Println(firstBook)
276 // Output: Book<Id=1 Title="book 1">
277}
278
279func ExampleDB_Model_selectLastRow() {
280 db := modelDB()

Callers

nothing calls this directly

Calls 3

modelDBFunction · 0.85
FirstMethod · 0.80
ModelMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…