// Code generated by goctl. DO NOT EDIT. package model import ( "context" "fmt" ) func (m *defaultFsProductSizeModel) CountByStatus(ctx context.Context, status int) (total int, err error) { query := fmt.Sprintf("select %s from %s where `status` = ? limit 1", "count(*) as num", m.table) err = m.conn.QueryRowCtx(ctx, &total, query, status) if err != nil { return 0, err } return } func (m *defaultFsProductSizeModel) FindAllByStatus(ctx context.Context, status int, sort int) (resp []FsProductSize, err error) { query := fmt.Sprintf("select %s from %s where `status` = ? ", fsProductSizeRows, m.table) switch sort { case 1: query = fmt.Sprintf("%s order by `sort` ASC", query) case 2: query = fmt.Sprintf("%s order by `sort` DESC", query) } err = m.conn.QueryRowsCtx(ctx, &resp, query, status) if err != nil { return nil, err } return }