package model import ( "fmt" "github.com/zeromicro/go-zero/core/stores/sqlx" ) var _ CbCustomerModel = (*customCbCustomerModel)(nil) type ( // CbCustomerModel is an interface to be customized, add more methods here, // and implement the added methods in customCbCustomerModel. CbCustomerModel interface { cbCustomerModel GetCustomerByExternalUserid(externalUserid string) (d *CbCustomer, err error) } customCbCustomerModel struct { *defaultCbCustomerModel } ) // NewCbCustomerModel returns a model for the database table. func NewCbCustomerModel(conn sqlx.SqlConn) CbCustomerModel { return &customCbCustomerModel{ defaultCbCustomerModel: newCbCustomerModel(conn), } } func (m *customCbCustomerModel) GetCustomerByExternalUserid(externalUserid string) (d *CbCustomer, err error) { query := fmt.Sprintf("select * from %s where `external_userid` = ? limit 1", m.table) var resp CbCustomer err = m.conn.QueryRow(&resp, query, externalUserid) d = &resp return }