39 lines
1.0 KiB
Go
39 lines
1.0 KiB
Go
|
package model
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"fmt"
|
||
|
"github.com/zeromicro/go-zero/core/stores/sqlx"
|
||
|
)
|
||
|
|
||
|
var _ FsStandardLogoModel = (*customFsStandardLogoModel)(nil)
|
||
|
|
||
|
type (
|
||
|
// FsStandardLogoModel is an interface to be customized, add more methods here,
|
||
|
// and implement the added methods in customFsStandardLogoModel.
|
||
|
FsStandardLogoModel interface {
|
||
|
fsStandardLogoModel
|
||
|
GetAll(ctx context.Context) (resp []FsStandardLogo, err error)
|
||
|
}
|
||
|
|
||
|
customFsStandardLogoModel struct {
|
||
|
*defaultFsStandardLogoModel
|
||
|
}
|
||
|
)
|
||
|
|
||
|
// NewFsStandardLogoModel returns a model for the database table.
|
||
|
func NewFsStandardLogoModel(conn sqlx.SqlConn) FsStandardLogoModel {
|
||
|
return &customFsStandardLogoModel{
|
||
|
defaultFsStandardLogoModel: newFsStandardLogoModel(conn),
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func (m *defaultFsStandardLogoModel) GetAll(ctx context.Context) (resp []FsStandardLogo, err error) {
|
||
|
query := fmt.Sprintf("select %s from %s where `status` = ? ", fsStandardLogoRows, m.table)
|
||
|
err = m.conn.QueryRowsCtx(ctx, &resp, query, 1)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
return
|
||
|
}
|