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

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