package data import ( "context" "fmt" "github.com/stretchr/testify/assert" "testing" "time" ) func cardRepo() *CardRepo { db := Conn() return NewCardRepo(db) } func TestCardRepo_List(t *testing.T) { repo := cardRepo() begin := time.Date(2018, 10, 1, 0, 0, 0, 0, time.Local) end := time.Date(2023, 12, 1, 0, 0, 0, 0, time.Local) cards, err := repo.List(context.Background(), begin, end, 10, "123") assert.Nil(t, err) fmt.Printf("%+v\n", cards) }