Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Golang 支持数据库 NULL 的三种方式
- import "database/sql"
- // 1. 使用指针
- type Info struct {
- Name *string
- }
- // 2. 使用 sql.NullString
- type Info2 struct {
- Name sql.NullString
- }
- // 3. 使用 SQL 函数
- // SELECT IFNULL(NULL, 'default-value');
Add Comment
Please, Sign In to add comment