mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +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:
@@ -39,18 +39,18 @@ type GroupEdges struct {
|
||||
loadedTypes [2]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
|
||||
}
|
||||
return nil, &NotLoadedError{edge: "users"}
|
||||
}
|
||||
|
||||
// AdminWithError returns the Admin value or an error if the edge
|
||||
// AdminErr returns the Admin value or an error if the edge
|
||||
// was not loaded in eager-loading, or loaded but was not found.
|
||||
func (e GroupEdges) AdminWithError() (*User, error) {
|
||||
func (e GroupEdges) AdminErr() (*User, error) {
|
||||
if e.loadedTypes[1] {
|
||||
if e.Admin == nil {
|
||||
// The edge admin was loaded in eager-loading,
|
||||
|
||||
@@ -39,18 +39,18 @@ type PetEdges struct {
|
||||
loadedTypes [2]bool
|
||||
}
|
||||
|
||||
// FriendsWithError returns the Friends value or an error if the edge
|
||||
// FriendsErr returns the Friends value or an error if the edge
|
||||
// was not loaded in eager-loading.
|
||||
func (e PetEdges) FriendsWithError() ([]*Pet, error) {
|
||||
func (e PetEdges) FriendsErr() ([]*Pet, error) {
|
||||
if e.loadedTypes[0] {
|
||||
return e.Friends, nil
|
||||
}
|
||||
return nil, &NotLoadedError{edge: "friends"}
|
||||
}
|
||||
|
||||
// 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 PetEdges) OwnerWithError() (*User, error) {
|
||||
func (e PetEdges) OwnerErr() (*User, error) {
|
||||
if e.loadedTypes[1] {
|
||||
if e.Owner == nil {
|
||||
// The edge owner was loaded in eager-loading,
|
||||
|
||||
@@ -43,36 +43,36 @@ type UserEdges struct {
|
||||
loadedTypes [4]bool
|
||||
}
|
||||
|
||||
// PetsWithError returns the Pets value or an error if the edge
|
||||
// PetsErr returns the Pets value or an error if the edge
|
||||
// was not loaded in eager-loading.
|
||||
func (e UserEdges) PetsWithError() ([]*Pet, error) {
|
||||
func (e UserEdges) PetsErr() ([]*Pet, error) {
|
||||
if e.loadedTypes[0] {
|
||||
return e.Pets, nil
|
||||
}
|
||||
return nil, &NotLoadedError{edge: "pets"}
|
||||
}
|
||||
|
||||
// FriendsWithError returns the Friends value or an error if the edge
|
||||
// FriendsErr returns the Friends value or an error if the edge
|
||||
// was not loaded in eager-loading.
|
||||
func (e UserEdges) FriendsWithError() ([]*User, error) {
|
||||
func (e UserEdges) FriendsErr() ([]*User, error) {
|
||||
if e.loadedTypes[1] {
|
||||
return e.Friends, nil
|
||||
}
|
||||
return nil, &NotLoadedError{edge: "friends"}
|
||||
}
|
||||
|
||||
// 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[2] {
|
||||
return e.Groups, nil
|
||||
}
|
||||
return nil, &NotLoadedError{edge: "groups"}
|
||||
}
|
||||
|
||||
// ManageWithError returns the Manage value or an error if the edge
|
||||
// ManageErr returns the Manage value or an error if the edge
|
||||
// was not loaded in eager-loading.
|
||||
func (e UserEdges) ManageWithError() ([]*Group, error) {
|
||||
func (e UserEdges) ManageErr() ([]*Group, error) {
|
||||
if e.loadedTypes[3] {
|
||||
return e.Manage, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user