Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StringFrom empty string #16

Open
Linus-Boehm opened this issue Apr 10, 2023 · 0 comments
Open

StringFrom empty string #16

Linus-Boehm opened this issue Apr 10, 2023 · 0 comments

Comments

@Linus-Boehm
Copy link

Linus-Boehm commented Apr 10, 2023

shouldn't the default behaviour of StringFrom called with an empty string result in Valid == false

So the code would look something like this:

func StringFrom(s string) String {
        valid := len(s) > 0
	return NewString(s, valid)
}

No hard opinion here and we will probably not change this, as this would be a breaking change especially for sqlboiler, just wondering what the reason behind this decision is. Currently this leads to nullable strings on the DB are set per default to
an empty string instead of null, when passing values from an API model with omitempty

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant