34 lines
786 B
Go
34 lines
786 B
Go
package data
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"github.com/stretchr/testify/assert"
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func directRepo() *DirectRepo {
|
|
db := Conn()
|
|
return NewDirectRepo(db)
|
|
}
|
|
|
|
func TestDirectRepo_List(t *testing.T) {
|
|
repo := directRepo()
|
|
begin := time.Date(2022, 10, 1, 0, 0, 0, 0, time.Local)
|
|
end := time.Date(2022, 12, 1, 0, 0, 0, 0, time.Local)
|
|
directs, err := repo.List(context.Background(), begin, end, 10, "123")
|
|
assert.Nil(t, err)
|
|
fmt.Printf("%+v\n", directs)
|
|
|
|
}
|
|
|
|
func TestDirectRepo_BatchList(t *testing.T) {
|
|
repo := directRepo()
|
|
begin := time.Date(2022, 10, 1, 0, 0, 0, 0, time.Local)
|
|
end := time.Date(2022, 12, 1, 0, 0, 0, 0, time.Local)
|
|
directs, err := repo.BatchList(context.Background(), begin, end, 10, "123")
|
|
assert.Nil(t, err)
|
|
fmt.Printf("%+v\n", directs)
|
|
}
|