Files
quyun-v2/backend/database/models/payout_accounts.gen.go
2025-12-29 09:30:49 +08:00

64 lines
2.4 KiB
Go

// Code generated by go.ipao.vip/gen. DO NOT EDIT.
// Code generated by go.ipao.vip/gen. DO NOT EDIT.
// Code generated by go.ipao.vip/gen. DO NOT EDIT.
package models
import (
"context"
"time"
"go.ipao.vip/gen"
)
const TableNamePayoutAccount = "payout_accounts"
// PayoutAccount mapped from table <payout_accounts>
type PayoutAccount struct {
ID int64 `gorm:"column:id;type:bigint;primaryKey;autoIncrement:true" json:"id"`
TenantID int64 `gorm:"column:tenant_id;type:bigint;not null" json:"tenant_id"`
UserID int64 `gorm:"column:user_id;type:bigint;not null" json:"user_id"`
Type string `gorm:"column:type;type:character varying(32);not null" json:"type"`
Name string `gorm:"column:name;type:character varying(128);not null" json:"name"`
Account string `gorm:"column:account;type:character varying(128);not null" json:"account"`
Realname string `gorm:"column:realname;type:character varying(128);not null" json:"realname"`
CreatedAt time.Time `gorm:"column:created_at;type:timestamp with time zone;default:now()" json:"created_at"`
UpdatedAt time.Time `gorm:"column:updated_at;type:timestamp with time zone;default:now()" json:"updated_at"`
}
// Quick operations without importing query package
// Update applies changed fields to the database using the default DB.
func (m *PayoutAccount) Update(ctx context.Context) (gen.ResultInfo, error) {
return Q.PayoutAccount.WithContext(ctx).Updates(m)
}
// Save upserts the model using the default DB.
func (m *PayoutAccount) Save(ctx context.Context) error {
return Q.PayoutAccount.WithContext(ctx).Save(m)
}
// Create inserts the model using the default DB.
func (m *PayoutAccount) Create(ctx context.Context) error {
return Q.PayoutAccount.WithContext(ctx).Create(m)
}
// Delete removes the row represented by the model using the default DB.
func (m *PayoutAccount) Delete(ctx context.Context) (gen.ResultInfo, error) {
return Q.PayoutAccount.WithContext(ctx).Delete(m)
}
// ForceDelete permanently deletes the row (ignores soft delete) using the default DB.
func (m *PayoutAccount) ForceDelete(ctx context.Context) (gen.ResultInfo, error) {
return Q.PayoutAccount.WithContext(ctx).Unscoped().Delete(m)
}
// Reload reloads the model from database by its primary key and overwrites current fields.
func (m *PayoutAccount) Reload(ctx context.Context) error {
fresh, err := Q.PayoutAccount.WithContext(ctx).GetByID(m.ID)
if err != nil {
return err
}
*m = *fresh
return nil
}