MCPcopy Index your code
hub / github.com/gocraft/dbr / ExampleInsertStmt_Record

Function ExampleInsertStmt_Record

example_test.go:89–107  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

87}
88
89func ExampleInsertStmt_Record() {
90 type Suggestion struct {
91 ID int64
92 Title NullString
93 CreatedAt time.Time
94 }
95 sugg := &Suggestion{
96 Title: NewNullString("Gopher"),
97 CreatedAt: time.Now(),
98 }
99 sess := mysqlSession
100 sess.InsertInto("suggestions").
101 Columns("title").
102 Record(&sugg).
103 Exec()
104
105 // id is set automatically
106 fmt.Println(sugg.ID)
107}
108
109func ExampleUpdateStmt() {
110 sess := mysqlSession

Callers

nothing calls this directly

Calls 5

NewNullStringFunction · 0.85
RecordMethod · 0.80
ColumnsMethod · 0.80
InsertIntoMethod · 0.65
ExecMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…