Vestmore_GO/model/killara_customer_logic.go
2024-04-08 18:13:01 +08:00

24 lines
454 B
Go

package model
import (
"context"
"fmt"
"github.com/jmoiron/sqlx"
)
type KillaraCustomerModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}
func (m *KillaraCustomerModel) Find(ctx context.Context) (result []*KillaraCustomer, err error) {
var customer []*KillaraCustomer
err = m.db.SelectContext(ctx, customer, fmt.Sprintf("select * from %s", m.TableName))
if err != nil {
return nil, err
}
return customer, nil
}