NewNullString from empty string
gennaios opened this issue · comments
Hello,
I'm wondering about how NewNullString handles strings of value "". If the example is as such:
title := "" // set from elsewhere
sugg := &Suggestion{
Title: NewNullString(title),
CreatedAt: time.Now(),
}
It seems that the database column value of title
is set to "" rather than NULL.
Figured it out by testing for length of string and then inserting NewNullString. This seems to be the idiomatic way.