entc/gen: use named fields on client creations (#359)

This commit is contained in:
Ariel Mashraki
2020-02-25 11:15:38 +02:00
committed by GitHub
parent dc222c0b15
commit 332cfe5c6e
62 changed files with 164 additions and 164 deletions

View File

@@ -74,14 +74,14 @@ func (c *City) assignValues(values ...interface{}) error {
// QueryStreets queries the streets edge of the City.
func (c *City) QueryStreets() *StreetQuery {
return (&CityClient{c.config}).QueryStreets(c)
return (&CityClient{config: c.config}).QueryStreets(c)
}
// Update returns a builder for updating this City.
// Note that, you need to call City.Unwrap() before calling this method, if this City
// was returned from a transaction, and the transaction was committed or rolled back.
func (c *City) Update() *CityUpdateOne {
return (&CityClient{c.config}).UpdateOne(c)
return (&CityClient{config: c.config}).UpdateOne(c)
}
// Unwrap unwraps the entity that was returned from a transaction after it was closed,

View File

@@ -97,14 +97,14 @@ func (s *Street) assignValues(values ...interface{}) error {
// QueryCity queries the city edge of the Street.
func (s *Street) QueryCity() *CityQuery {
return (&StreetClient{s.config}).QueryCity(s)
return (&StreetClient{config: s.config}).QueryCity(s)
}
// Update returns a builder for updating this Street.
// Note that, you need to call Street.Unwrap() before calling this method, if this Street
// was returned from a transaction, and the transaction was committed or rolled back.
func (s *Street) Update() *StreetUpdateOne {
return (&StreetClient{s.config}).UpdateOne(s)
return (&StreetClient{config: s.config}).UpdateOne(s)
}
// Unwrap unwraps the entity that was returned from a transaction after it was closed,

View File

@@ -47,7 +47,7 @@ func (u *User) assignValues(values ...interface{}) error {
// Note that, you need to call User.Unwrap() before calling this method, if this User
// was returned from a transaction, and the transaction was committed or rolled back.
func (u *User) Update() *UserUpdateOne {
return (&UserClient{u.config}).UpdateOne(u)
return (&UserClient{config: u.config}).UpdateOne(u)
}
// Unwrap unwraps the entity that was returned from a transaction after it was closed,

View File

@@ -74,14 +74,14 @@ func (gr *Group) assignValues(values ...interface{}) error {
// QueryUsers queries the users edge of the Group.
func (gr *Group) QueryUsers() *UserQuery {
return (&GroupClient{gr.config}).QueryUsers(gr)
return (&GroupClient{config: gr.config}).QueryUsers(gr)
}
// Update returns a builder for updating this Group.
// Note that, you need to call Group.Unwrap() before calling this method, if this Group
// was returned from a transaction, and the transaction was committed or rolled back.
func (gr *Group) Update() *GroupUpdateOne {
return (&GroupClient{gr.config}).UpdateOne(gr)
return (&GroupClient{config: gr.config}).UpdateOne(gr)
}
// Unwrap unwraps the entity that was returned from a transaction after it was closed,

View File

@@ -82,14 +82,14 @@ func (u *User) assignValues(values ...interface{}) error {
// QueryGroups queries the groups edge of the User.
func (u *User) QueryGroups() *GroupQuery {
return (&UserClient{u.config}).QueryGroups(u)
return (&UserClient{config: u.config}).QueryGroups(u)
}
// Update returns a builder for updating this User.
// Note that, you need to call User.Unwrap() before calling this method, if this User
// was returned from a transaction, and the transaction was committed or rolled back.
func (u *User) Update() *UserUpdateOne {
return (&UserClient{u.config}).UpdateOne(u)
return (&UserClient{config: u.config}).UpdateOne(u)
}
// Unwrap unwraps the entity that was returned from a transaction after it was closed,

View File

@@ -82,14 +82,14 @@ func (u *User) assignValues(values ...interface{}) error {
// QueryFriends queries the friends edge of the User.
func (u *User) QueryFriends() *UserQuery {
return (&UserClient{u.config}).QueryFriends(u)
return (&UserClient{config: u.config}).QueryFriends(u)
}
// Update returns a builder for updating this User.
// Note that, you need to call User.Unwrap() before calling this method, if this User
// was returned from a transaction, and the transaction was committed or rolled back.
func (u *User) Update() *UserUpdateOne {
return (&UserClient{u.config}).UpdateOne(u)
return (&UserClient{config: u.config}).UpdateOne(u)
}
// Unwrap unwraps the entity that was returned from a transaction after it was closed,

View File

@@ -93,19 +93,19 @@ func (u *User) assignValues(values ...interface{}) error {
// QueryFollowers queries the followers edge of the User.
func (u *User) QueryFollowers() *UserQuery {
return (&UserClient{u.config}).QueryFollowers(u)
return (&UserClient{config: u.config}).QueryFollowers(u)
}
// QueryFollowing queries the following edge of the User.
func (u *User) QueryFollowing() *UserQuery {
return (&UserClient{u.config}).QueryFollowing(u)
return (&UserClient{config: u.config}).QueryFollowing(u)
}
// Update returns a builder for updating this User.
// Note that, you need to call User.Unwrap() before calling this method, if this User
// was returned from a transaction, and the transaction was committed or rolled back.
func (u *User) Update() *UserUpdateOne {
return (&UserClient{u.config}).UpdateOne(u)
return (&UserClient{config: u.config}).UpdateOne(u)
}
// Unwrap unwraps the entity that was returned from a transaction after it was closed,

View File

@@ -97,14 +97,14 @@ func (pe *Pet) assignValues(values ...interface{}) error {
// QueryOwner queries the owner edge of the Pet.
func (pe *Pet) QueryOwner() *UserQuery {
return (&PetClient{pe.config}).QueryOwner(pe)
return (&PetClient{config: pe.config}).QueryOwner(pe)
}
// Update returns a builder for updating this Pet.
// Note that, you need to call Pet.Unwrap() before calling this method, if this Pet
// was returned from a transaction, and the transaction was committed or rolled back.
func (pe *Pet) Update() *PetUpdateOne {
return (&PetClient{pe.config}).UpdateOne(pe)
return (&PetClient{config: pe.config}).UpdateOne(pe)
}
// Unwrap unwraps the entity that was returned from a transaction after it was closed,

View File

@@ -82,14 +82,14 @@ func (u *User) assignValues(values ...interface{}) error {
// QueryPets queries the pets edge of the User.
func (u *User) QueryPets() *PetQuery {
return (&UserClient{u.config}).QueryPets(u)
return (&UserClient{config: u.config}).QueryPets(u)
}
// Update returns a builder for updating this User.
// Note that, you need to call User.Unwrap() before calling this method, if this User
// was returned from a transaction, and the transaction was committed or rolled back.
func (u *User) Update() *UserUpdateOne {
return (&UserClient{u.config}).UpdateOne(u)
return (&UserClient{config: u.config}).UpdateOne(u)
}
// Unwrap unwraps the entity that was returned from a transaction after it was closed,

View File

@@ -107,19 +107,19 @@ func (n *Node) assignValues(values ...interface{}) error {
// QueryParent queries the parent edge of the Node.
func (n *Node) QueryParent() *NodeQuery {
return (&NodeClient{n.config}).QueryParent(n)
return (&NodeClient{config: n.config}).QueryParent(n)
}
// QueryChildren queries the children edge of the Node.
func (n *Node) QueryChildren() *NodeQuery {
return (&NodeClient{n.config}).QueryChildren(n)
return (&NodeClient{config: n.config}).QueryChildren(n)
}
// Update returns a builder for updating this Node.
// Note that, you need to call Node.Unwrap() before calling this method, if this Node
// was returned from a transaction, and the transaction was committed or rolled back.
func (n *Node) Update() *NodeUpdateOne {
return (&NodeClient{n.config}).UpdateOne(n)
return (&NodeClient{config: n.config}).UpdateOne(n)
}
// Unwrap unwraps the entity that was returned from a transaction after it was closed,

View File

@@ -106,14 +106,14 @@ func (c *Card) assignValues(values ...interface{}) error {
// QueryOwner queries the owner edge of the Card.
func (c *Card) QueryOwner() *UserQuery {
return (&CardClient{c.config}).QueryOwner(c)
return (&CardClient{config: c.config}).QueryOwner(c)
}
// Update returns a builder for updating this Card.
// Note that, you need to call Card.Unwrap() before calling this method, if this Card
// was returned from a transaction, and the transaction was committed or rolled back.
func (c *Card) Update() *CardUpdateOne {
return (&CardClient{c.config}).UpdateOne(c)
return (&CardClient{config: c.config}).UpdateOne(c)
}
// Unwrap unwraps the entity that was returned from a transaction after it was closed,

View File

@@ -88,14 +88,14 @@ func (u *User) assignValues(values ...interface{}) error {
// QueryCard queries the card edge of the User.
func (u *User) QueryCard() *CardQuery {
return (&UserClient{u.config}).QueryCard(u)
return (&UserClient{config: u.config}).QueryCard(u)
}
// Update returns a builder for updating this User.
// Note that, you need to call User.Unwrap() before calling this method, if this User
// was returned from a transaction, and the transaction was committed or rolled back.
func (u *User) Update() *UserUpdateOne {
return (&UserClient{u.config}).UpdateOne(u)
return (&UserClient{config: u.config}).UpdateOne(u)
}
// Unwrap unwraps the entity that was returned from a transaction after it was closed,

View File

@@ -104,14 +104,14 @@ func (u *User) assignValues(values ...interface{}) error {
// QuerySpouse queries the spouse edge of the User.
func (u *User) QuerySpouse() *UserQuery {
return (&UserClient{u.config}).QuerySpouse(u)
return (&UserClient{config: u.config}).QuerySpouse(u)
}
// Update returns a builder for updating this User.
// Note that, you need to call User.Unwrap() before calling this method, if this User
// was returned from a transaction, and the transaction was committed or rolled back.
func (u *User) Update() *UserUpdateOne {
return (&UserClient{u.config}).UpdateOne(u)
return (&UserClient{config: u.config}).UpdateOne(u)
}
// Unwrap unwraps the entity that was returned from a transaction after it was closed,

View File

@@ -112,19 +112,19 @@ func (n *Node) assignValues(values ...interface{}) error {
// QueryPrev queries the prev edge of the Node.
func (n *Node) QueryPrev() *NodeQuery {
return (&NodeClient{n.config}).QueryPrev(n)
return (&NodeClient{config: n.config}).QueryPrev(n)
}
// QueryNext queries the next edge of the Node.
func (n *Node) QueryNext() *NodeQuery {
return (&NodeClient{n.config}).QueryNext(n)
return (&NodeClient{config: n.config}).QueryNext(n)
}
// Update returns a builder for updating this Node.
// Note that, you need to call Node.Unwrap() before calling this method, if this Node
// was returned from a transaction, and the transaction was committed or rolled back.
func (n *Node) Update() *NodeUpdateOne {
return (&NodeClient{n.config}).UpdateOne(n)
return (&NodeClient{config: n.config}).UpdateOne(n)
}
// Unwrap unwraps the entity that was returned from a transaction after it was closed,

View File

@@ -106,14 +106,14 @@ func (c *Car) assignValues(values ...interface{}) error {
// QueryOwner queries the owner edge of the Car.
func (c *Car) QueryOwner() *UserQuery {
return (&CarClient{c.config}).QueryOwner(c)
return (&CarClient{config: c.config}).QueryOwner(c)
}
// Update returns a builder for updating this Car.
// Note that, you need to call Car.Unwrap() before calling this method, if this Car
// was returned from a transaction, and the transaction was committed or rolled back.
func (c *Car) Update() *CarUpdateOne {
return (&CarClient{c.config}).UpdateOne(c)
return (&CarClient{config: c.config}).UpdateOne(c)
}
// Unwrap unwraps the entity that was returned from a transaction after it was closed,

View File

@@ -74,14 +74,14 @@ func (gr *Group) assignValues(values ...interface{}) error {
// QueryUsers queries the users edge of the Group.
func (gr *Group) QueryUsers() *UserQuery {
return (&GroupClient{gr.config}).QueryUsers(gr)
return (&GroupClient{config: gr.config}).QueryUsers(gr)
}
// Update returns a builder for updating this Group.
// Note that, you need to call Group.Unwrap() before calling this method, if this Group
// was returned from a transaction, and the transaction was committed or rolled back.
func (gr *Group) Update() *GroupUpdateOne {
return (&GroupClient{gr.config}).UpdateOne(gr)
return (&GroupClient{config: gr.config}).UpdateOne(gr)
}
// Unwrap unwraps the entity that was returned from a transaction after it was closed,

View File

@@ -93,19 +93,19 @@ func (u *User) assignValues(values ...interface{}) error {
// QueryCars queries the cars edge of the User.
func (u *User) QueryCars() *CarQuery {
return (&UserClient{u.config}).QueryCars(u)
return (&UserClient{config: u.config}).QueryCars(u)
}
// QueryGroups queries the groups edge of the User.
func (u *User) QueryGroups() *GroupQuery {
return (&UserClient{u.config}).QueryGroups(u)
return (&UserClient{config: u.config}).QueryGroups(u)
}
// Update returns a builder for updating this User.
// Note that, you need to call User.Unwrap() before calling this method, if this User
// was returned from a transaction, and the transaction was committed or rolled back.
func (u *User) Update() *UserUpdateOne {
return (&UserClient{u.config}).UpdateOne(u)
return (&UserClient{config: u.config}).UpdateOne(u)
}
// Unwrap unwraps the entity that was returned from a transaction after it was closed,

View File

@@ -108,19 +108,19 @@ func (gr *Group) assignValues(values ...interface{}) error {
// QueryUsers queries the users edge of the Group.
func (gr *Group) QueryUsers() *UserQuery {
return (&GroupClient{gr.config}).QueryUsers(gr)
return (&GroupClient{config: gr.config}).QueryUsers(gr)
}
// QueryAdmin queries the admin edge of the Group.
func (gr *Group) QueryAdmin() *UserQuery {
return (&GroupClient{gr.config}).QueryAdmin(gr)
return (&GroupClient{config: gr.config}).QueryAdmin(gr)
}
// Update returns a builder for updating this Group.
// Note that, you need to call Group.Unwrap() before calling this method, if this Group
// was returned from a transaction, and the transaction was committed or rolled back.
func (gr *Group) Update() *GroupUpdateOne {
return (&GroupClient{gr.config}).UpdateOne(gr)
return (&GroupClient{config: gr.config}).UpdateOne(gr)
}
// Unwrap unwraps the entity that was returned from a transaction after it was closed,

View File

@@ -108,19 +108,19 @@ func (pe *Pet) assignValues(values ...interface{}) error {
// QueryFriends queries the friends edge of the Pet.
func (pe *Pet) QueryFriends() *PetQuery {
return (&PetClient{pe.config}).QueryFriends(pe)
return (&PetClient{config: pe.config}).QueryFriends(pe)
}
// QueryOwner queries the owner edge of the Pet.
func (pe *Pet) QueryOwner() *UserQuery {
return (&PetClient{pe.config}).QueryOwner(pe)
return (&PetClient{config: pe.config}).QueryOwner(pe)
}
// Update returns a builder for updating this Pet.
// Note that, you need to call Pet.Unwrap() before calling this method, if this Pet
// was returned from a transaction, and the transaction was committed or rolled back.
func (pe *Pet) Update() *PetUpdateOne {
return (&PetClient{pe.config}).UpdateOne(pe)
return (&PetClient{config: pe.config}).UpdateOne(pe)
}
// Unwrap unwraps the entity that was returned from a transaction after it was closed,

View File

@@ -115,29 +115,29 @@ func (u *User) assignValues(values ...interface{}) error {
// QueryPets queries the pets edge of the User.
func (u *User) QueryPets() *PetQuery {
return (&UserClient{u.config}).QueryPets(u)
return (&UserClient{config: u.config}).QueryPets(u)
}
// QueryFriends queries the friends edge of the User.
func (u *User) QueryFriends() *UserQuery {
return (&UserClient{u.config}).QueryFriends(u)
return (&UserClient{config: u.config}).QueryFriends(u)
}
// QueryGroups queries the groups edge of the User.
func (u *User) QueryGroups() *GroupQuery {
return (&UserClient{u.config}).QueryGroups(u)
return (&UserClient{config: u.config}).QueryGroups(u)
}
// QueryManage queries the manage edge of the User.
func (u *User) QueryManage() *GroupQuery {
return (&UserClient{u.config}).QueryManage(u)
return (&UserClient{config: u.config}).QueryManage(u)
}
// Update returns a builder for updating this User.
// Note that, you need to call User.Unwrap() before calling this method, if this User
// was returned from a transaction, and the transaction was committed or rolled back.
func (u *User) Update() *UserUpdateOne {
return (&UserClient{u.config}).UpdateOne(u)
return (&UserClient{config: u.config}).UpdateOne(u)
}
// Unwrap unwraps the entity that was returned from a transaction after it was closed,