[go: nahoru, domu]

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

Added IsZero(), alias of IsNil() #90

Merged
merged 2 commits into from
Oct 27, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Added IsZero(), alias of IsNil()
Some libraries (e.g. JSON marshalers together with `omitempty` struct flags) supports `IsZero()` for skipping empty values.
  • Loading branch information
Webbmekanikern committed Oct 27, 2022
commit 84feb1907c063a88fd792c1e7f5fa3bcb55772dd
5 changes: 5 additions & 0 deletions id.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,11 @@ func (id ID) IsNil() bool {
return id == nilID
}

// Alias of IsNil
func (id ID) IsZero() bool {
return IsNil()
}

// NilID returns a zero value for `xid.ID`.
func NilID() ID {
return nilID
Expand Down