Skip to content

How do I handle insert of nil value into NOT NULL column? #1399

Answered by jackc
n0vice asked this question in Q&A
Discussion options

You must be logged in to vote

Go nil values are always considered as SQL NULL. This happens before any methods on the type are called.

I would have expected it to work with string as the underlying value though. The zeronull.Text type value automatically translates "" to NULL. You should be able to adapt that to translate "" to {}.

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@n0vice
Comment options

@jackc
Comment options

@n0vice
Comment options

@jackc
Comment options

@n0vice
Comment options

Answer selected by n0vice
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants