mirror of
https://github.com/ent/ent.git
synced 2026-05-22 09:31:45 +03:00
entc/gen: change <E>WithError signature to <E>Err (#322)
<E>WithError is too verbose and we like short names
This commit is contained in:
@@ -40,9 +40,9 @@ type CarEdges struct {
|
||||
loadedTypes [1]bool
|
||||
}
|
||||
|
||||
// OwnerWithError returns the Owner value or an error if the edge
|
||||
// OwnerErr returns the Owner value or an error if the edge
|
||||
// was not loaded in eager-loading, or loaded but was not found.
|
||||
func (e CarEdges) OwnerWithError() (*User, error) {
|
||||
func (e CarEdges) OwnerErr() (*User, error) {
|
||||
if e.loadedTypes[0] {
|
||||
if e.Owner == nil {
|
||||
// The edge owner was loaded in eager-loading,
|
||||
|
||||
@@ -35,9 +35,9 @@ type GroupEdges struct {
|
||||
loadedTypes [1]bool
|
||||
}
|
||||
|
||||
// UsersWithError returns the Users value or an error if the edge
|
||||
// UsersErr returns the Users value or an error if the edge
|
||||
// was not loaded in eager-loading.
|
||||
func (e GroupEdges) UsersWithError() ([]*User, error) {
|
||||
func (e GroupEdges) UsersErr() ([]*User, error) {
|
||||
if e.loadedTypes[0] {
|
||||
return e.Users, nil
|
||||
}
|
||||
|
||||
@@ -39,18 +39,18 @@ type UserEdges struct {
|
||||
loadedTypes [2]bool
|
||||
}
|
||||
|
||||
// CarsWithError returns the Cars value or an error if the edge
|
||||
// CarsErr returns the Cars value or an error if the edge
|
||||
// was not loaded in eager-loading.
|
||||
func (e UserEdges) CarsWithError() ([]*Car, error) {
|
||||
func (e UserEdges) CarsErr() ([]*Car, error) {
|
||||
if e.loadedTypes[0] {
|
||||
return e.Cars, nil
|
||||
}
|
||||
return nil, &NotLoadedError{edge: "cars"}
|
||||
}
|
||||
|
||||
// GroupsWithError returns the Groups value or an error if the edge
|
||||
// GroupsErr returns the Groups value or an error if the edge
|
||||
// was not loaded in eager-loading.
|
||||
func (e UserEdges) GroupsWithError() ([]*Group, error) {
|
||||
func (e UserEdges) GroupsErr() ([]*Group, error) {
|
||||
if e.loadedTypes[1] {
|
||||
return e.Groups, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user