fix: shop_players 关系表主键与模型对齐

This commit is contained in:
zetaloop
2026-04-04 06:25:49 +08:00
parent 3a81aec527
commit 7dc088eadf
18 changed files with 91 additions and 310 deletions
+1 -10
View File
@@ -15,8 +15,6 @@ import (
// ShopPlayers is the model entity for the ShopPlayers schema.
type ShopPlayers struct {
config `json:"-"`
// ID of the ent.
ID int64 `json:"id,omitempty"`
// ShopID holds the value of the "shop_id" field.
ShopID int64 `json:"shop_id,omitempty"`
// PlayerID holds the value of the "player_id" field.
@@ -37,7 +35,7 @@ func (*ShopPlayers) scanValues(columns []string) ([]any, error) {
switch columns[i] {
case shopplayers.FieldIsPrimary:
values[i] = new(sql.NullBool)
case shopplayers.FieldID, shopplayers.FieldShopID, shopplayers.FieldPlayerID:
case shopplayers.FieldShopID, shopplayers.FieldPlayerID:
values[i] = new(sql.NullInt64)
case shopplayers.FieldJoinedAt, shopplayers.FieldLeftAt:
values[i] = new(sql.NullTime)
@@ -56,12 +54,6 @@ func (_m *ShopPlayers) assignValues(columns []string, values []any) error {
}
for i := range columns {
switch columns[i] {
case shopplayers.FieldID:
value, ok := values[i].(*sql.NullInt64)
if !ok {
return fmt.Errorf("unexpected type %T for field id", value)
}
_m.ID = int64(value.Int64)
case shopplayers.FieldShopID:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field shop_id", values[i])
@@ -128,7 +120,6 @@ func (_m *ShopPlayers) Unwrap() *ShopPlayers {
func (_m *ShopPlayers) String() string {
var builder strings.Builder
builder.WriteString("ShopPlayers(")
builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
builder.WriteString("shop_id=")
builder.WriteString(fmt.Sprintf("%v", _m.ShopID))
builder.WriteString(", ")