Skip to content

StringFrom empty string #16

Description

@Linus-Boehm

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions