特朗普头像任务
This commit is contained in:
96
internal/model/nh_games_property_logs_model_gen.go
Executable file
96
internal/model/nh_games_property_logs_model_gen.go
Executable file
@@ -0,0 +1,96 @@
|
||||
// Code generated by goctl. DO NOT EDIT.
|
||||
// versions:
|
||||
// goctl version: 1.7.3
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/stores/builder"
|
||||
"github.com/zeromicro/go-zero/core/stores/sqlx"
|
||||
"github.com/zeromicro/go-zero/core/stringx"
|
||||
)
|
||||
|
||||
var (
|
||||
nhGamesPropertyLogsFieldNames = builder.RawFieldNames(&NhGamesPropertyLogs{})
|
||||
nhGamesPropertyLogsRows = strings.Join(nhGamesPropertyLogsFieldNames, ",")
|
||||
nhGamesPropertyLogsRowsExpectAutoSet = strings.Join(stringx.Remove(nhGamesPropertyLogsFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), ",")
|
||||
nhGamesPropertyLogsRowsWithPlaceHolder = strings.Join(stringx.Remove(nhGamesPropertyLogsFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), "=?,") + "=?"
|
||||
)
|
||||
|
||||
type (
|
||||
nhGamesPropertyLogsModel interface {
|
||||
Insert(ctx context.Context, data *NhGamesPropertyLogs) (sql.Result, error)
|
||||
FindOne(ctx context.Context, id uint) (*NhGamesPropertyLogs, error)
|
||||
Update(ctx context.Context, data *NhGamesPropertyLogs) error
|
||||
Delete(ctx context.Context, id uint) error
|
||||
}
|
||||
|
||||
defaultNhGamesPropertyLogsModel struct {
|
||||
conn sqlx.SqlConn
|
||||
table string
|
||||
}
|
||||
|
||||
NhGamesPropertyLogs struct {
|
||||
Id uint `db:"id"`
|
||||
Uid uint `db:"uid"` // 用户ID
|
||||
RoleId int64 `db:"role_id"` // 角色id
|
||||
PropertyId string `db:"property_id"` // 道具ID
|
||||
PropertyNum uint `db:"property_num"` // 道具数量
|
||||
Scene uint `db:"scene"` // 场景:1=积分活动
|
||||
CallbackStatus int8 `db:"callback_status"` // 下发通知状态:0未通知,1已通知,2通知异常
|
||||
CallbackNum int `db:"callback_num"` // 交易成功发送通知次数
|
||||
CallbackAt sql.NullTime `db:"callback_at"` // 发送通知最新时间
|
||||
CallbackRemark string `db:"callback_remark"` // 通知回调备注
|
||||
CreatedAt time.Time `db:"created_at"` // 创建时间
|
||||
UpdatedAt time.Time `db:"updated_at"` // 修改时间
|
||||
}
|
||||
)
|
||||
|
||||
func newNhGamesPropertyLogsModel(conn sqlx.SqlConn) *defaultNhGamesPropertyLogsModel {
|
||||
return &defaultNhGamesPropertyLogsModel{
|
||||
conn: conn,
|
||||
table: "`nh_games_property_logs`",
|
||||
}
|
||||
}
|
||||
|
||||
func (m *defaultNhGamesPropertyLogsModel) Delete(ctx context.Context, id uint) error {
|
||||
query := fmt.Sprintf("delete from %s where `id` = ?", m.table)
|
||||
_, err := m.conn.ExecCtx(ctx, query, id)
|
||||
return err
|
||||
}
|
||||
|
||||
func (m *defaultNhGamesPropertyLogsModel) FindOne(ctx context.Context, id uint) (*NhGamesPropertyLogs, error) {
|
||||
query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", nhGamesPropertyLogsRows, m.table)
|
||||
var resp NhGamesPropertyLogs
|
||||
err := m.conn.QueryRowCtx(ctx, &resp, query, id)
|
||||
switch err {
|
||||
case nil:
|
||||
return &resp, nil
|
||||
case sqlx.ErrNotFound:
|
||||
return nil, ErrNotFound
|
||||
default:
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
func (m *defaultNhGamesPropertyLogsModel) Insert(ctx context.Context, data *NhGamesPropertyLogs) (sql.Result, error) {
|
||||
query := fmt.Sprintf("insert into %s (%s) values (?, ?, ?, ?, ?, ?, ?, ?, ?)", m.table, nhGamesPropertyLogsRowsExpectAutoSet)
|
||||
ret, err := m.conn.ExecCtx(ctx, query, data.Uid, data.RoleId, data.PropertyId, data.PropertyNum, data.Scene, data.CallbackStatus, data.CallbackNum, data.CallbackAt, data.CallbackRemark)
|
||||
return ret, err
|
||||
}
|
||||
|
||||
func (m *defaultNhGamesPropertyLogsModel) Update(ctx context.Context, data *NhGamesPropertyLogs) error {
|
||||
query := fmt.Sprintf("update %s set %s where `id` = ?", m.table, nhGamesPropertyLogsRowsWithPlaceHolder)
|
||||
_, err := m.conn.ExecCtx(ctx, query, data.Uid, data.RoleId, data.PropertyId, data.PropertyNum, data.Scene, data.CallbackStatus, data.CallbackNum, data.CallbackAt, data.CallbackRemark, data.Id)
|
||||
return err
|
||||
}
|
||||
|
||||
func (m *defaultNhGamesPropertyLogsModel) tableName() string {
|
||||
return m.table
|
||||
}
|
||||
Reference in New Issue
Block a user