You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@eventmesh.apache.org by mi...@apache.org on 2022/10/08 06:38:45 UTC
[incubator-eventmesh] branch master updated: modify eventmesh-catalog internal module, support QueryOperations api
This is an automated email from the ASF dual-hosted git repository.
mikexue pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-eventmesh.git
The following commit(s) were added to refs/heads/master by this push:
new ebfaac56 modify eventmesh-catalog internal module, support QueryOperations api
new 945028d1 Merge pull request #1468 from walterlife/modify-catalog-internal
ebfaac56 is described below
commit ebfaac567f83d2dacabb1a016d1741ce333493a0
Author: walterlife <wa...@gmail.com>
AuthorDate: Sat Oct 1 21:00:59 2022 +0800
modify eventmesh-catalog internal module, support QueryOperations api
---
eventmesh-catalog-go/internal/dal/catalog.go | 15 +++++++--------
eventmesh-catalog-go/internal/dal/model/event_catalog.go | 1 +
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/eventmesh-catalog-go/internal/dal/catalog.go b/eventmesh-catalog-go/internal/dal/catalog.go
index 61483c2c..a98bd7f3 100644
--- a/eventmesh-catalog-go/internal/dal/catalog.go
+++ b/eventmesh-catalog-go/internal/dal/catalog.go
@@ -22,7 +22,7 @@ import (
)
type CatalogDAL interface {
- Select(ctx context.Context, operationID string) (*model.EventCatalog, error)
+ SelectOperations(ctx context.Context, serviceName string, operationID string) ([]*model.EventCatalog, error)
Insert(ctx context.Context, tx *gorm.DB, record *model.EventCatalog) error
InsertEvent(ctx context.Context, tx *gorm.DB, record *model.Event) error
}
@@ -35,15 +35,14 @@ func NewCatalogDAL() CatalogDAL {
type catalogDALImpl struct {
}
-func (c *catalogDALImpl) Select(ctx context.Context, operationID string) (*model.EventCatalog, error) {
- var res model.EventCatalog
- if err := GetDalClient().Where("operation_id = ? AND status = 1", operationID).First(&res).Error; err != nil {
- if err == gorm.ErrRecordNotFound {
- return nil, nil
- }
+func (c *catalogDALImpl) SelectOperations(ctx context.Context, serviceName string,
+ operationID string) ([]*model.EventCatalog, error) {
+ var res []*model.EventCatalog
+ var condition = model.EventCatalog{ServiceName: serviceName, OperationID: operationID}
+ if err := GetDalClient().WithContext(ctx).Where(&condition).Find(&res).Error; err != nil {
return nil, err
}
- return &res, nil
+ return res, nil
}
func (c *catalogDALImpl) Insert(ctx context.Context, tx *gorm.DB, record *model.EventCatalog) error {
diff --git a/eventmesh-catalog-go/internal/dal/model/event_catalog.go b/eventmesh-catalog-go/internal/dal/model/event_catalog.go
index 3d7e06a6..450b3172 100644
--- a/eventmesh-catalog-go/internal/dal/model/event_catalog.go
+++ b/eventmesh-catalog-go/internal/dal/model/event_catalog.go
@@ -21,6 +21,7 @@ import (
type EventCatalog struct {
ID int `json:"id" gorm:"column:id;type:int;primaryKey;autoIncrement"`
+ ServiceName string `json:"service_name" gorm:"column:service_name;type:varchar;size:256"`
OperationID string `json:"operation_id" gorm:"column:operation_id;type:varchar;size:1024"`
ChannelName string `json:"channel_name" gorm:"column:channel_name;type:varchar;size:1024"`
Type string `json:"type" gorm:"column:type;type:string"`
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: commits-help@eventmesh.apache.org