Created
July 17, 2018 17:32
-
-
Save Casxt/5354436ce1690dbe62d97762fdd3d67e to your computer and use it in GitHub Desktop.
[Golang] Use pointer to deal sql null value | 使用指针处理SQL NULL 值
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ( | |
nullInt *int | |
nullTime *time.Time | |
nullString string | |
) | |
row := course.QueryRow("SELECT NULL,NULL,NULL FROM Table", LineID) | |
DBErr = row.Scan(&nullInt, &nullTime, &nullString); | |
if DBErr != nil { | |
return | |
} | |
if nullInt == nil{ | |
} | |
if nullTime == nil { | |
} | |
if nullString == nil { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment