fusenapi/model/fsqrcodesetmodel.go
2023-06-19 10:12:58 +08:00

40 lines
982 B
Go
Executable File

package gmodel
import (
"context"
"fmt"
"github.com/zeromicro/go-zero/core/stores/sqlx"
)
var _ FsQrcodeSetModel = (*customFsQrcodeSetModel)(nil)
type (
// FsQrcodeSetModel is an interface to be customized, add more methods here,
// and implement the added methods in customFsQrcodeSetModel.
FsQrcodeSetModel interface {
fsQrcodeSetModel
GetAll(ctx context.Context) (resp []FsQrcodeSet, err error)
}
customFsQrcodeSetModel struct {
*defaultFsQrcodeSetModel
}
)
// NewFsQrcodeSetModel returns a model for the database table.
func NewFsQrcodeSetModel(conn sqlx.SqlConn) FsQrcodeSetModel {
return &customFsQrcodeSetModel{
defaultFsQrcodeSetModel: newFsQrcodeSetModel(conn),
}
}
func (m *defaultFsQrcodeSetModel) GetAll(ctx context.Context) (resp []FsQrcodeSet, err error) {
query := fmt.Sprintf("select %s from %s where `status` = ?", fsQrcodeSetRows, m.table)
err = m.conn.QueryRowsCtx(ctx, &resp, query, 1)
if err != nil {
return nil, err
}
return
}