fix: 复合主键表改为单字段 id 以支持 ent 完整生成

This commit is contained in:
zetaloop
2026-04-24 07:32:52 +08:00
parent c62d743320
commit 5ad579f03c
19 changed files with 324 additions and 82 deletions
+27 -4
View File
@@ -410,6 +410,12 @@ func (c *ShopPlayersClient) UpdateOne(_m *ShopPlayers) *ShopPlayersUpdateOne {
return &ShopPlayersUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
// UpdateOneID returns an update builder for the given id.
func (c *ShopPlayersClient) UpdateOneID(id int64) *ShopPlayersUpdateOne {
mutation := newShopPlayersMutation(c.config, OpUpdateOne, withShopPlayersID(id))
return &ShopPlayersUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
// Delete returns a delete builder for ShopPlayers.
func (c *ShopPlayersClient) Delete() *ShopPlayersDelete {
mutation := newShopPlayersMutation(c.config, OpDelete)
@@ -418,10 +424,13 @@ func (c *ShopPlayersClient) Delete() *ShopPlayersDelete {
// DeleteOne returns a builder for deleting the given entity.
func (c *ShopPlayersClient) DeleteOne(_m *ShopPlayers) *ShopPlayersDeleteOne {
builder := c.Delete().Where(
shopplayers.ShopIDEQ(_m.ShopID),
shopplayers.PlayerIDEQ(_m.PlayerID),
)
return c.DeleteOneID(_m.ID)
}
// DeleteOneID returns a builder for deleting the given entity by its id.
func (c *ShopPlayersClient) DeleteOneID(id int64) *ShopPlayersDeleteOne {
builder := c.Delete().Where(shopplayers.ID(id))
builder.mutation.id = &id
builder.mutation.op = OpDeleteOne
return &ShopPlayersDeleteOne{builder}
}
@@ -435,6 +444,20 @@ func (c *ShopPlayersClient) Query() *ShopPlayersQuery {
}
}
// Get returns a ShopPlayers entity by its id.
func (c *ShopPlayersClient) Get(ctx context.Context, id int64) (*ShopPlayers, error) {
return c.Query().Where(shopplayers.ID(id)).Only(ctx)
}
// GetX is like Get, but panics if an error occurs.
func (c *ShopPlayersClient) GetX(ctx context.Context, id int64) *ShopPlayers {
obj, err := c.Get(ctx, id)
if err != nil {
panic(err)
}
return obj
}
// Hooks returns the client hooks.
func (c *ShopPlayersClient) Hooks() []Hook {
return c.hooks.ShopPlayers