You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

createadapterlogic.go 979 B

12345678910111213141516171819202122232425262728293031323334353637
  1. package adapters
  2. import (
  3. "context"
  4. "github.com/zeromicro/go-zero/core/logx"
  5. "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
  6. "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
  7. "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
  8. "time"
  9. )
  10. type CreateAdapterLogic struct {
  11. logx.Logger
  12. ctx context.Context
  13. svcCtx *svc.ServiceContext
  14. }
  15. func NewCreateAdapterLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateAdapterLogic {
  16. return &CreateAdapterLogic{
  17. Logger: logx.WithContext(ctx),
  18. ctx: ctx,
  19. svcCtx: svcCtx,
  20. }
  21. }
  22. func (l *CreateAdapterLogic) CreateAdapter(req *types.AdapterCreateReq) (resp *types.AdapterResp, err error) {
  23. adapter := types.AdapterInfo{}
  24. utils.Convert(req, &adapter)
  25. adapter.Id = utils.GenSnowflakeIDStr()
  26. adapter.CreateTime = time.Now().Format("2006-01-02 15:04:05")
  27. result := l.svcCtx.DbEngin.Table("t_adapter").Create(&adapter)
  28. if result.Error != nil {
  29. return nil, result.Error
  30. }
  31. return
  32. }

PCM is positioned as Software stack over Cloud, aiming to build the standards and ecology of heterogeneous cloud collaboration for JCC in a non intrusive and autonomous peer-to-peer manner.