37 lines
938 B
Go
Executable File
37 lines
938 B
Go
Executable File
package model
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"github.com/zeromicro/go-zero/core/stores/sqlx"
|
|
)
|
|
|
|
var _ FsUserModel = (*customFsUserModel)(nil)
|
|
|
|
type (
|
|
// FsUserModel is an interface to be customized, add more methods here,
|
|
// and implement the added methods in customFsUserModel.
|
|
FsUserModel interface {
|
|
fsUserModel
|
|
UpdateVerificationToken(ctx context.Context, userid int64, token string) error
|
|
}
|
|
|
|
customFsUserModel struct {
|
|
*defaultFsUserModel
|
|
}
|
|
)
|
|
|
|
// NewFsUserModel returns a model for the database table.
|
|
func NewFsUserModel(conn sqlx.SqlConn) FsUserModel {
|
|
return &customFsUserModel{
|
|
defaultFsUserModel: newFsUserModel(conn),
|
|
}
|
|
}
|
|
|
|
func (m *defaultFsUserModel) UpdateVerificationToken(ctx context.Context, userid int64, verificationToken string) error {
|
|
query := fmt.Sprintf("update %s set `verification_token` = ? where `id` = ?", m.table)
|
|
_, err := m.conn.ExecCtx(ctx, query, verificationToken, userid)
|
|
return err
|
|
}
|