entc/gen: update NotSingularError godoc (#2274)

* fix: update only/onlyID comments

this patch updates the Only/OnlyID methods in the builder template from:

> // Returns a *NotSingularError when exactly one {{ $.Name }} entity is not found.
to
> // Returns a *NotSingularError when more than exactly one {{ $.Name }} ID is found.

in an effort to be more explicit in the explanation of the behavior of the methods.

* fix: update wording to be more concise from suggestion

Co-authored-by: Rotem Tamir <rotemtamir@gmail.com>

* fix: update Only wording to be more concicse

* fix: generate new files

Co-authored-by: Rotem Tamir <rotemtamir@gmail.com>
This commit is contained in:
Nicholas Anderson
2022-01-23 09:07:10 -08:00
committed by GitHub
parent 84aac96a1c
commit 896f2b202d
102 changed files with 204 additions and 204 deletions

View File

@@ -110,7 +110,7 @@ func (uq *UserQuery) FirstIDX(ctx context.Context) int {
}
// Only returns a single User entity found by the query, ensuring it only returns one.
// Returns a *NotSingularError when exactly one User entity is not found.
// Returns a *NotSingularError when more than one User entity is found.
// Returns a *NotFoundError when no User entities are found.
func (uq *UserQuery) Only(ctx context.Context) (*User, error) {
nodes, err := uq.Limit(2).All(ctx)
@@ -137,7 +137,7 @@ func (uq *UserQuery) OnlyX(ctx context.Context) *User {
}
// OnlyID is like Only, but returns the only User ID in the query.
// Returns a *NotSingularError when exactly one User ID is not found.
// Returns a *NotSingularError when more than one User ID is found.
// Returns a *NotFoundError when no entities are found.
func (uq *UserQuery) OnlyID(ctx context.Context) (id int, err error) {
var ids []int