pg_partner_info_dao.go
786 字节
package dao
import (
"fmt"
"gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/infrastructure/pg/models"
"gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/infrastructure/pg/transaction"
)
type PartnerInfoDao struct {
transactionContext *transaction.TransactionContext
}
func NewPartnerInfoDao(transactionContext *transaction.TransactionContext) (*PartnerInfoDao, error) {
if transactionContext == nil {
return nil, fmt.Errorf("transactionContext参数不能为nil")
} else {
return &PartnerInfoDao{
transactionContext: transactionContext,
}, nil
}
}
func (dao PartnerInfoDao) PartnerAccountExist(account string) (bool, error) {
tx := dao.transactionContext.PgDd
m := &models.PartnerInfo{}
ok, err := tx.Model(m).
Where("account=?", account).
Exists()
return ok, err
}