From 4b7175bd2b75e320867422357964ffd56401c210 Mon Sep 17 00:00:00 2001 From: trunglt251292 Date: Mon, 22 Aug 2022 10:06:29 +0700 Subject: [PATCH] [Update] struct query es --- constants.go | 5 +++++ pull.go | 5 +++++ request.go | 15 +++++++++++++++ 3 files changed, 25 insertions(+) diff --git a/constants.go b/constants.go index dabd903..d5cab07 100644 --- a/constants.go +++ b/constants.go @@ -6,6 +6,11 @@ const ( SubjectRequestProductSkuSearch = "selly.request.product_sku.search" SubjectRequestProductSkuCreateIndex = "selly.request.product_sku.create_index" + SubjectRequestShopProductUpsert = "selly.request.shop_product.upsert" + SubjectPullShopProductUpsert = "selly.pull.shop_product.upsert" + SubjectRequestShopProductSearch = "selly.request.shop_product.search" + SubjectRequestShopProductCreateIndex = "selly.request.shop_product.create_index" + SubjectRequestProductUpsert = "selly.request.product.upsert" SubjectPullProductUpsert = "selly.pull.product.upsert" SubjectRequestProductSearch = "selly.request.product.search" diff --git a/pull.go b/pull.go index cb02ba9..1314383 100644 --- a/pull.go +++ b/pull.go @@ -28,3 +28,8 @@ func (Pull) KeywordUpsert(payload Payload) (bool, error) { func (Pull) ProductSkuUpsert(payload Payload) (bool, error) { return publishWithJetStream(JetStreamSearchService, SubjectPullProductSkuUpsert, toBytes(payload)) } + +// ProductShopUpsert ... +func (Pull) ProductShopUpsert(payload Payload) (bool, error) { + return publishWithJetStream(JetStreamSearchService, SubjectPullShopProductUpsert, toBytes(payload)) +} diff --git a/request.go b/request.go index cb21ffe..543f680 100644 --- a/request.go +++ b/request.go @@ -4,6 +4,21 @@ package elasticsearch type Request struct { } +// ProductShopSearch ... +func (Request) ProductShopSearch(query ESQuery) (*Response, error) { + return requestNats(SubjectRequestShopProductSearch, toBytes(query)) +} + +// ProductShopUpsert ... +func (Request) ProductShopUpsert(payload Payload) (*Response, error) { + return requestNats(SubjectRequestShopProductUpsert, toBytes(payload)) +} + +// ProductShopCreateIndex ... +func (Request) ProductShopCreateIndex() (*Response, error) { + return requestNats(SubjectRequestShopProductCreateIndex, toBytes(Payload{})) +} + // ProductSkuSearch ... func (Request) ProductSkuSearch(query ESQuery) (*Response, error) { return requestNats(SubjectRequestProductSkuSearch, toBytes(query))