MCPcopy Create free account
hub / github.com/Masterminds/structable / loadFromSql

Method loadFromSql

sqlite_ptr_test.go:44–57  ·  view source on GitHub ↗
(Id int64, db *sql.DB)

Source from the content-addressed store, hash-verified

42}
43
44func (m *Movie) loadFromSql(Id int64, db *sql.DB) error {
45
46 if m.Genre == nil {
47 m.Genre = new(string)
48 }
49 err := db.QueryRow("SELECT title, genre, budget FROM movies WHERE id=?", Id).Scan(
50 &m.Title,
51 m.Genre,
52 &m.Budget)
53 if err == nil {
54 m.Id = Id
55 }
56 return err
57}
58
59func TestStructWithPointerInsert(t *testing.T) {
60

Callers 2

Calls 2

ScanMethod · 0.80
QueryRowMethod · 0.80

Tested by

no test coverage detected