shad-go/lectures/07-sql/nulls/insert_value.go

7 lines
158 B
Go
Raw Normal View History

2020-04-08 19:20:23 +00:00
name := sql.NullString{Value: "The Shrike",Valid: true}
db.ExecContext(
ctx,
"INSERT INTO users(name) VALUES(@name)"),
sql.Named("name", name),
)