39 lines
980 B
Go
39 lines
980 B
Go
|
package model
|
||
|
|
||
|
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
|
||
|
}
|