feat: add users page

This commit is contained in:
yanghao05
2025-04-10 21:04:35 +08:00
parent ed27cb3534
commit 5a63eee1ce
22 changed files with 797 additions and 60 deletions

View File

@@ -6,12 +6,16 @@ import (
"quyun/app/service/testx"
"quyun/database"
"quyun/database/fields"
"quyun/database/schemas/public/model"
"quyun/database/schemas/public/table"
"github.com/samber/lo"
. "github.com/smartystreets/goconvey/convey"
"go.ipao.vip/atom/contracts"
// . "github.com/go-jet/jet/v2/postgres"
gonanoid "github.com/matoous/go-nanoid/v2"
"github.com/stretchr/testify/suite"
"go.uber.org/dig"
)
@@ -36,8 +40,25 @@ func Test_Users(t *testing.T) {
})
}
func (s *UsersTestSuite) Test_Demo() {
Convey("Test_Demo", s.T(), func() {
func (s *UsersTestSuite) Test_BatchInsert() {
Convey("Test_BatchInsert", s.T(), func() {
database.Truncate(context.Background(), db, table.Users.TableName())
count := 100
for i := 0; i < count; i++ {
// generate openid use nanoid
openID, err := gonanoid.New(10)
So(err, ShouldBeNil)
user := &model.Users{
Status: fields.UserStatusOk,
OpenID: openID,
Username: "Username_" + openID,
Avatar: lo.ToPtr("Avatar_" + openID),
}
err = Users.Create(context.Background(), user)
So(err, ShouldBeNil)
}
})
}