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:
Ariel Mashraki
2020-01-30 11:12:53 +02:00
committed by GitHub
parent 27935a8c6c
commit 9e760aae58
49 changed files with 203 additions and 203 deletions

View File

@@ -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,

View File

@@ -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,

View File

@@ -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
}