Vestmore_GO/model/killara_customer_logic.go

24 lines
454 B
Go
Raw Normal View History

2024-04-07 16:03:37 +00:00
package model
2024-04-08 10:13:01 +00:00
import (
"context"
"fmt"
"github.com/jmoiron/sqlx"
)
2024-04-07 16:03:37 +00:00
type KillaraCustomerModel struct {
// fields ...
2024-04-08 10:13:01 +00:00
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
2024-04-07 16:03:37 +00:00
}