From c777793d96162456d56759868a1b836a47619322 Mon Sep 17 00:00:00 2001 From: Zexi Li Date: Tue, 14 Jul 2020 17:46:42 +0800 Subject: [PATCH] db_dispatcher: pass query for fetchItem --- pkg/cloudcommon/db/db_dispatcher.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/cloudcommon/db/db_dispatcher.go b/pkg/cloudcommon/db/db_dispatcher.go index 85d6e77bc5..11592b46da 100644 --- a/pkg/cloudcommon/db/db_dispatcher.go +++ b/pkg/cloudcommon/db/db_dispatcher.go @@ -1473,7 +1473,7 @@ func (dispatcher *DBModelDispatcher) PerformClassAction(ctx context.Context, act func (dispatcher *DBModelDispatcher) PerformAction(ctx context.Context, idStr string, action string, query jsonutils.JSONObject, data jsonutils.JSONObject) (jsonutils.JSONObject, error) { userCred := fetchUserCredential(ctx) - model, err := fetchItem(dispatcher.modelManager, ctx, userCred, idStr, nil) + model, err := fetchItem(dispatcher.modelManager, ctx, userCred, idStr, query) if err == sql.ErrNoRows { return nil, httperrors.NewResourceNotFoundError2(dispatcher.modelManager.Keyword(), idStr) } else if err != nil { @@ -1659,7 +1659,7 @@ func (dispatcher *DBModelDispatcher) FetchUpdateHeaderData(ctx context.Context, func (dispatcher *DBModelDispatcher) Update(ctx context.Context, idStr string, query jsonutils.JSONObject, data jsonutils.JSONObject, ctxIds []dispatcher.SResourceContext) (jsonutils.JSONObject, error) { userCred := fetchUserCredential(ctx) - model, err := fetchItem(dispatcher.modelManager, ctx, userCred, idStr, nil) + model, err := fetchItem(dispatcher.modelManager, ctx, userCred, idStr, query) if err == sql.ErrNoRows { return nil, httperrors.NewResourceNotFoundError2(dispatcher.modelManager.Keyword(), idStr) } else if err != nil { @@ -1692,7 +1692,7 @@ func (dispatcher *DBModelDispatcher) Update(ctx context.Context, idStr string, q func (dispatcher *DBModelDispatcher) UpdateSpec(ctx context.Context, idStr string, spec string, query jsonutils.JSONObject, data jsonutils.JSONObject) (jsonutils.JSONObject, error) { userCred := fetchUserCredential(ctx) - model, err := fetchItem(dispatcher.modelManager, ctx, userCred, idStr, nil) + model, err := fetchItem(dispatcher.modelManager, ctx, userCred, idStr, query) if err == sql.ErrNoRows { return nil, httperrors.NewResourceNotFoundError2(dispatcher.modelManager.Keyword(), idStr) } else if err != nil { @@ -1762,7 +1762,7 @@ func deleteItem(manager IModelManager, model IModel, ctx context.Context, userCr func (dispatcher *DBModelDispatcher) Delete(ctx context.Context, idstr string, query jsonutils.JSONObject, data jsonutils.JSONObject, ctxIds []dispatcher.SResourceContext) (jsonutils.JSONObject, error) { userCred := fetchUserCredential(ctx) - model, err := fetchItem(dispatcher.modelManager, ctx, userCred, idstr, nil) + model, err := fetchItem(dispatcher.modelManager, ctx, userCred, idstr, query) if err == sql.ErrNoRows { return nil, httperrors.NewResourceNotFoundError2(dispatcher.modelManager.Keyword(), idstr) } else if err != nil { @@ -1796,7 +1796,7 @@ func (dispatcher *DBModelDispatcher) Delete(ctx context.Context, idstr string, q func (dispatcher *DBModelDispatcher) DeleteSpec(ctx context.Context, idstr string, spec string, query jsonutils.JSONObject, data jsonutils.JSONObject) (jsonutils.JSONObject, error) { userCred := fetchUserCredential(ctx) - model, err := fetchItem(dispatcher.modelManager, ctx, userCred, idstr, nil) + model, err := fetchItem(dispatcher.modelManager, ctx, userCred, idstr, query) if err == sql.ErrNoRows { return nil, httperrors.NewResourceNotFoundError2(dispatcher.modelManager.Keyword(), idstr) } else if err != nil {