mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
entc/gen: fix gen for type abbreviating to id (#750)
* cmd/ent: fix gen for type abbreviating to id * Adding genc output changes to tests, examples
This commit is contained in:
@@ -204,11 +204,11 @@ func (c *CityClient) Get(ctx context.Context, id int) (*City, error) {
|
||||
|
||||
// GetX is like Get, but panics if an error occurs.
|
||||
func (c *CityClient) GetX(ctx context.Context, id int) *City {
|
||||
ci, err := c.Get(ctx, id)
|
||||
obj, err := c.Get(ctx, id)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return ci
|
||||
return obj
|
||||
}
|
||||
|
||||
// QueryStreets queries the streets edge of a City.
|
||||
@@ -308,11 +308,11 @@ func (c *StreetClient) Get(ctx context.Context, id int) (*Street, error) {
|
||||
|
||||
// GetX is like Get, but panics if an error occurs.
|
||||
func (c *StreetClient) GetX(ctx context.Context, id int) *Street {
|
||||
s, err := c.Get(ctx, id)
|
||||
obj, err := c.Get(ctx, id)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return s
|
||||
return obj
|
||||
}
|
||||
|
||||
// QueryCity queries the city edge of a Street.
|
||||
|
||||
@@ -196,11 +196,11 @@ func (c *UserClient) Get(ctx context.Context, id int) (*User, error) {
|
||||
|
||||
// GetX is like Get, but panics if an error occurs.
|
||||
func (c *UserClient) GetX(ctx context.Context, id int) *User {
|
||||
u, err := c.Get(ctx, id)
|
||||
obj, err := c.Get(ctx, id)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return u
|
||||
return obj
|
||||
}
|
||||
|
||||
// Hooks returns the client hooks.
|
||||
|
||||
@@ -204,11 +204,11 @@ func (c *GroupClient) Get(ctx context.Context, id int) (*Group, error) {
|
||||
|
||||
// GetX is like Get, but panics if an error occurs.
|
||||
func (c *GroupClient) GetX(ctx context.Context, id int) *Group {
|
||||
gr, err := c.Get(ctx, id)
|
||||
obj, err := c.Get(ctx, id)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return gr
|
||||
return obj
|
||||
}
|
||||
|
||||
// QueryUsers queries the users edge of a Group.
|
||||
@@ -308,11 +308,11 @@ func (c *UserClient) Get(ctx context.Context, id int) (*User, error) {
|
||||
|
||||
// GetX is like Get, but panics if an error occurs.
|
||||
func (c *UserClient) GetX(ctx context.Context, id int) *User {
|
||||
u, err := c.Get(ctx, id)
|
||||
obj, err := c.Get(ctx, id)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return u
|
||||
return obj
|
||||
}
|
||||
|
||||
// QueryGroups queries the groups edge of a User.
|
||||
|
||||
@@ -197,11 +197,11 @@ func (c *UserClient) Get(ctx context.Context, id int) (*User, error) {
|
||||
|
||||
// GetX is like Get, but panics if an error occurs.
|
||||
func (c *UserClient) GetX(ctx context.Context, id int) *User {
|
||||
u, err := c.Get(ctx, id)
|
||||
obj, err := c.Get(ctx, id)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return u
|
||||
return obj
|
||||
}
|
||||
|
||||
// QueryFriends queries the friends edge of a User.
|
||||
|
||||
@@ -197,11 +197,11 @@ func (c *UserClient) Get(ctx context.Context, id int) (*User, error) {
|
||||
|
||||
// GetX is like Get, but panics if an error occurs.
|
||||
func (c *UserClient) GetX(ctx context.Context, id int) *User {
|
||||
u, err := c.Get(ctx, id)
|
||||
obj, err := c.Get(ctx, id)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return u
|
||||
return obj
|
||||
}
|
||||
|
||||
// QueryFollowers queries the followers edge of a User.
|
||||
|
||||
@@ -204,11 +204,11 @@ func (c *PetClient) Get(ctx context.Context, id int) (*Pet, error) {
|
||||
|
||||
// GetX is like Get, but panics if an error occurs.
|
||||
func (c *PetClient) GetX(ctx context.Context, id int) *Pet {
|
||||
pe, err := c.Get(ctx, id)
|
||||
obj, err := c.Get(ctx, id)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return pe
|
||||
return obj
|
||||
}
|
||||
|
||||
// QueryOwner queries the owner edge of a Pet.
|
||||
@@ -308,11 +308,11 @@ func (c *UserClient) Get(ctx context.Context, id int) (*User, error) {
|
||||
|
||||
// GetX is like Get, but panics if an error occurs.
|
||||
func (c *UserClient) GetX(ctx context.Context, id int) *User {
|
||||
u, err := c.Get(ctx, id)
|
||||
obj, err := c.Get(ctx, id)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return u
|
||||
return obj
|
||||
}
|
||||
|
||||
// QueryPets queries the pets edge of a User.
|
||||
|
||||
@@ -197,11 +197,11 @@ func (c *NodeClient) Get(ctx context.Context, id int) (*Node, error) {
|
||||
|
||||
// GetX is like Get, but panics if an error occurs.
|
||||
func (c *NodeClient) GetX(ctx context.Context, id int) *Node {
|
||||
n, err := c.Get(ctx, id)
|
||||
obj, err := c.Get(ctx, id)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return n
|
||||
return obj
|
||||
}
|
||||
|
||||
// QueryParent queries the parent edge of a Node.
|
||||
|
||||
@@ -204,11 +204,11 @@ func (c *CardClient) Get(ctx context.Context, id int) (*Card, error) {
|
||||
|
||||
// GetX is like Get, but panics if an error occurs.
|
||||
func (c *CardClient) GetX(ctx context.Context, id int) *Card {
|
||||
ca, err := c.Get(ctx, id)
|
||||
obj, err := c.Get(ctx, id)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return ca
|
||||
return obj
|
||||
}
|
||||
|
||||
// QueryOwner queries the owner edge of a Card.
|
||||
@@ -308,11 +308,11 @@ func (c *UserClient) Get(ctx context.Context, id int) (*User, error) {
|
||||
|
||||
// GetX is like Get, but panics if an error occurs.
|
||||
func (c *UserClient) GetX(ctx context.Context, id int) *User {
|
||||
u, err := c.Get(ctx, id)
|
||||
obj, err := c.Get(ctx, id)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return u
|
||||
return obj
|
||||
}
|
||||
|
||||
// QueryCard queries the card edge of a User.
|
||||
|
||||
@@ -197,11 +197,11 @@ func (c *UserClient) Get(ctx context.Context, id int) (*User, error) {
|
||||
|
||||
// GetX is like Get, but panics if an error occurs.
|
||||
func (c *UserClient) GetX(ctx context.Context, id int) *User {
|
||||
u, err := c.Get(ctx, id)
|
||||
obj, err := c.Get(ctx, id)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return u
|
||||
return obj
|
||||
}
|
||||
|
||||
// QuerySpouse queries the spouse edge of a User.
|
||||
|
||||
@@ -197,11 +197,11 @@ func (c *NodeClient) Get(ctx context.Context, id int) (*Node, error) {
|
||||
|
||||
// GetX is like Get, but panics if an error occurs.
|
||||
func (c *NodeClient) GetX(ctx context.Context, id int) *Node {
|
||||
n, err := c.Get(ctx, id)
|
||||
obj, err := c.Get(ctx, id)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return n
|
||||
return obj
|
||||
}
|
||||
|
||||
// QueryPrev queries the prev edge of a Node.
|
||||
|
||||
@@ -211,11 +211,11 @@ func (c *CarClient) Get(ctx context.Context, id int) (*Car, error) {
|
||||
|
||||
// GetX is like Get, but panics if an error occurs.
|
||||
func (c *CarClient) GetX(ctx context.Context, id int) *Car {
|
||||
ca, err := c.Get(ctx, id)
|
||||
obj, err := c.Get(ctx, id)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return ca
|
||||
return obj
|
||||
}
|
||||
|
||||
// QueryOwner queries the owner edge of a Car.
|
||||
@@ -315,11 +315,11 @@ func (c *GroupClient) Get(ctx context.Context, id int) (*Group, error) {
|
||||
|
||||
// GetX is like Get, but panics if an error occurs.
|
||||
func (c *GroupClient) GetX(ctx context.Context, id int) *Group {
|
||||
gr, err := c.Get(ctx, id)
|
||||
obj, err := c.Get(ctx, id)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return gr
|
||||
return obj
|
||||
}
|
||||
|
||||
// QueryUsers queries the users edge of a Group.
|
||||
@@ -419,11 +419,11 @@ func (c *UserClient) Get(ctx context.Context, id int) (*User, error) {
|
||||
|
||||
// GetX is like Get, but panics if an error occurs.
|
||||
func (c *UserClient) GetX(ctx context.Context, id int) *User {
|
||||
u, err := c.Get(ctx, id)
|
||||
obj, err := c.Get(ctx, id)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return u
|
||||
return obj
|
||||
}
|
||||
|
||||
// QueryCars queries the cars edge of a User.
|
||||
|
||||
@@ -211,11 +211,11 @@ func (c *GroupClient) Get(ctx context.Context, id int) (*Group, error) {
|
||||
|
||||
// GetX is like Get, but panics if an error occurs.
|
||||
func (c *GroupClient) GetX(ctx context.Context, id int) *Group {
|
||||
gr, err := c.Get(ctx, id)
|
||||
obj, err := c.Get(ctx, id)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return gr
|
||||
return obj
|
||||
}
|
||||
|
||||
// QueryUsers queries the users edge of a Group.
|
||||
@@ -331,11 +331,11 @@ func (c *PetClient) Get(ctx context.Context, id int) (*Pet, error) {
|
||||
|
||||
// GetX is like Get, but panics if an error occurs.
|
||||
func (c *PetClient) GetX(ctx context.Context, id int) *Pet {
|
||||
pe, err := c.Get(ctx, id)
|
||||
obj, err := c.Get(ctx, id)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return pe
|
||||
return obj
|
||||
}
|
||||
|
||||
// QueryFriends queries the friends edge of a Pet.
|
||||
@@ -451,11 +451,11 @@ func (c *UserClient) Get(ctx context.Context, id int) (*User, error) {
|
||||
|
||||
// GetX is like Get, but panics if an error occurs.
|
||||
func (c *UserClient) GetX(ctx context.Context, id int) *User {
|
||||
u, err := c.Get(ctx, id)
|
||||
obj, err := c.Get(ctx, id)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return u
|
||||
return obj
|
||||
}
|
||||
|
||||
// QueryPets queries the pets edge of a User.
|
||||
|
||||
Reference in New Issue
Block a user