代码拉取完成,页面将自动刷新
// Code generated by goctl. DO NOT EDIT.
package mysql
import (
"context"
"database/sql"
"fmt"
"strings"
"github.com/zeromicro/go-zero/core/stores/builder"
"github.com/zeromicro/go-zero/core/stores/sqlc"
"github.com/zeromicro/go-zero/core/stores/sqlx"
"github.com/zeromicro/go-zero/core/stringx"
)
var (
appLflytekKeyInfoFieldNames = builder.RawFieldNames(&AppLflytekKeyInfo{})
appLflytekKeyInfoRows = strings.Join(appLflytekKeyInfoFieldNames, ",")
appLflytekKeyInfoRowsExpectAutoSet = strings.Join(stringx.Remove(appLflytekKeyInfoFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), ",")
appLflytekKeyInfoRowsWithPlaceHolder = strings.Join(stringx.Remove(appLflytekKeyInfoFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), "=?,") + "=?"
)
type (
appLflytekKeyInfoModel interface {
Insert(ctx context.Context, data *AppLflytekKeyInfo) (sql.Result, error)
FindOne(ctx context.Context, id int64) (*AppLflytekKeyInfo, error)
FindOneLatest(ctx context.Context) (*AppLflytekKeyInfo, error)
Update(ctx context.Context, data *AppLflytekKeyInfo) error
Delete(ctx context.Context, id int64) error
}
defaultAppLflytekKeyInfoModel struct {
conn sqlx.SqlConn
table string
}
AppLflytekKeyInfo struct {
Id int64 `db:"id"` // id
AppID string `db:"appID"` // 日志类型
ApiSecret string `db:"apiSecret"` // uuid
ApiKey string `db:"apiKey"` // 系统
Ctime int64 `db:"ctime"` // 修改时间
}
)
func newAppLflytekKeyInfoModel(conn sqlx.SqlConn) *defaultAppLflytekKeyInfoModel {
return &defaultAppLflytekKeyInfoModel{
conn: conn,
table: "`app_lflytek_key_info`",
}
}
func (m *defaultAppLflytekKeyInfoModel) Delete(ctx context.Context, id int64) error {
query := fmt.Sprintf("delete from %s where `id` = ?", m.table)
_, err := m.conn.ExecCtx(ctx, query, id)
return err
}
func (m *defaultAppLflytekKeyInfoModel) FindOne(ctx context.Context, id int64) (*AppLflytekKeyInfo, error) {
query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", appLflytekKeyInfoRows, m.table)
var resp AppLflytekKeyInfo
err := m.conn.QueryRowCtx(ctx, &resp, query, id)
switch err {
case nil:
return &resp, nil
case sqlc.ErrNotFound:
return nil, ErrNotFound
default:
return nil, err
}
}
func (m *defaultAppLflytekKeyInfoModel) Insert(ctx context.Context, data *AppLflytekKeyInfo) (sql.Result, error) {
query := fmt.Sprintf("insert into %s (%s) values (?, ?, ?, ?)", m.table, appLflytekKeyInfoRowsExpectAutoSet)
ret, err := m.conn.ExecCtx(ctx, query, data.AppID, data.ApiSecret, data.ApiKey, data.Ctime)
return ret, err
}
func (m *defaultAppLflytekKeyInfoModel) Update(ctx context.Context, data *AppLflytekKeyInfo) error {
query := fmt.Sprintf("update %s set %s where `id` = ?", m.table, appLflytekKeyInfoRowsWithPlaceHolder)
_, err := m.conn.ExecCtx(ctx, query, data.AppID, data.ApiSecret, data.ApiKey, data.Ctime, data.Id)
return err
}
func (m *defaultAppLflytekKeyInfoModel) tableName() string {
return m.table
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。