mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
entc/gen: change <E>Err signature to <E>OrErr (#325)
Signed-off-by: Alex Snast <alexsn@fb.com>
This commit is contained in:
@@ -40,9 +40,9 @@ type CarEdges struct {
|
||||
loadedTypes [1]bool
|
||||
}
|
||||
|
||||
// OwnerErr returns the Owner value or an error if the edge
|
||||
// OwnerOrErr 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) OwnerErr() (*User, error) {
|
||||
func (e CarEdges) OwnerOrErr() (*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
|
||||
}
|
||||
|
||||
// UsersErr returns the Users value or an error if the edge
|
||||
// UsersOrErr returns the Users value or an error if the edge
|
||||
// was not loaded in eager-loading.
|
||||
func (e GroupEdges) UsersErr() ([]*User, error) {
|
||||
func (e GroupEdges) UsersOrErr() ([]*User, error) {
|
||||
if e.loadedTypes[0] {
|
||||
return e.Users, nil
|
||||
}
|
||||
|
||||
@@ -39,18 +39,18 @@ type UserEdges struct {
|
||||
loadedTypes [2]bool
|
||||
}
|
||||
|
||||
// CarsErr returns the Cars value or an error if the edge
|
||||
// CarsOrErr returns the Cars value or an error if the edge
|
||||
// was not loaded in eager-loading.
|
||||
func (e UserEdges) CarsErr() ([]*Car, error) {
|
||||
func (e UserEdges) CarsOrErr() ([]*Car, error) {
|
||||
if e.loadedTypes[0] {
|
||||
return e.Cars, nil
|
||||
}
|
||||
return nil, &NotLoadedError{edge: "cars"}
|
||||
}
|
||||
|
||||
// GroupsErr returns the Groups value or an error if the edge
|
||||
// GroupsOrErr returns the Groups value or an error if the edge
|
||||
// was not loaded in eager-loading.
|
||||
func (e UserEdges) GroupsErr() ([]*Group, error) {
|
||||
func (e UserEdges) GroupsOrErr() ([]*Group, error) {
|
||||
if e.loadedTypes[1] {
|
||||
return e.Groups, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user