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

Unable to use a zero value KSUID with a sql driver/database #79

Open
odannyc opened this issue Nov 20, 2023 · 0 comments
Open

Unable to use a zero value KSUID with a sql driver/database #79

odannyc opened this issue Nov 20, 2023 · 0 comments

Comments

@odannyc
Copy link

odannyc commented Nov 20, 2023

I'd like to pass all 0s to sql for querying, for example:

SELECT *
FROM users
WHERE id > '000000000000000000000000000';

This is not possible currently because this library treats a zero value ksuid as nil: https://github.com/segmentio/ksuid/blob/master/ksuid.go#L139-L144

func (i KSUID) Value() (driver.Value, error) {
	if i.IsNil() {
		return nil, nil
	}
	return i.String(), nil
}

Is there something I'm missing on how to pass 0s to sql or is it not possible? I'd like to avoid having to manage my own type which simply shadows the Value func if possible.

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