mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
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:
committed by
GitHub
parent
84aac96a1c
commit
896f2b202d
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user