You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
741 B
40 lines
741 B
package PgTest
|
|
|
|
import (
|
|
"context"
|
|
|
|
"demo/internal/svc"
|
|
"demo/internal/types"
|
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
)
|
|
|
|
type PgSearchTestLogic struct {
|
|
logx.Logger
|
|
ctx context.Context
|
|
svcCtx *svc.ServiceContext
|
|
}
|
|
|
|
func NewPgSearchTestLogic(ctx context.Context, svcCtx *svc.ServiceContext) *PgSearchTestLogic {
|
|
return &PgSearchTestLogic{
|
|
Logger: logx.WithContext(ctx),
|
|
ctx: ctx,
|
|
svcCtx: svcCtx,
|
|
}
|
|
}
|
|
|
|
func (l *PgSearchTestLogic) PgSearchTest() (resp *types.TestResponse, err error) {
|
|
|
|
// 查询数据库
|
|
data, err := l.svcCtx.PgModel.FindOne(l.ctx, "findonetest")
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
resp = &types.TestResponse{
|
|
Success: true,
|
|
Message: "查询成功",
|
|
Result: *data,
|
|
}
|
|
|
|
return resp, nil
|
|
}
|
|
|