From 3c44b218126e270e45adb0e65eda7da6651f1a48 Mon Sep 17 00:00:00 2001 From: trunglt251292 Date: Thu, 28 Apr 2022 10:59:43 +0700 Subject: [PATCH] [Update] product sku --- constants.go | 5 +++++ pull.go | 5 +++++ request.go | 15 +++++++++++++++ struct.go | 2 ++ 4 files changed, 27 insertions(+) diff --git a/constants.go b/constants.go index 4001f1d..dabd903 100644 --- a/constants.go +++ b/constants.go @@ -1,6 +1,11 @@ package elasticsearch const ( + SubjectRequestProductSkuUpsert = "selly.request.product_sku.upsert" + SubjectPullProductSkuUpsert = "selly.pull.product_sku.upsert" + SubjectRequestProductSkuSearch = "selly.request.product_sku.search" + SubjectRequestProductSkuCreateIndex = "selly.request.product_sku.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 9ec9170..cb02ba9 100644 --- a/pull.go +++ b/pull.go @@ -23,3 +23,8 @@ func (Pull) OrderUpsert(payload Payload) (bool, error) { func (Pull) KeywordUpsert(payload Payload) (bool, error) { return publishWithJetStream(JetStreamSearchService, SubjectPullKeywordUpsert, toBytes(payload)) } + +// ProductSkuUpsert ... +func (Pull) ProductSkuUpsert(payload Payload) (bool, error) { + return publishWithJetStream(JetStreamSearchService, SubjectPullProductSkuUpsert, toBytes(payload)) +} diff --git a/request.go b/request.go index d2f87a4..cb21ffe 100644 --- a/request.go +++ b/request.go @@ -4,6 +4,21 @@ package elasticsearch type Request struct { } +// ProductSkuSearch ... +func (Request) ProductSkuSearch(query ESQuery) (*Response, error) { + return requestNats(SubjectRequestProductSkuSearch, toBytes(query)) +} + +// ProductSkuUpsert ... +func (Request) ProductSkuUpsert(payload Payload) (*Response, error) { + return requestNats(SubjectRequestProductSkuUpsert, toBytes(payload)) +} + +// ProductSkuCreateIndex ... +func (Request) ProductSkuCreateIndex() (*Response, error) { + return requestNats(SubjectRequestProductSkuCreateIndex, toBytes(Payload{})) +} + // ProductSearch ... func (Request) ProductSearch(query ESQuery) (*Response, error) { return requestNats(SubjectRequestProductSearch, toBytes(query)) diff --git a/struct.go b/struct.go index c0b3c9f..fb48471 100644 --- a/struct.go +++ b/struct.go @@ -93,6 +93,8 @@ type ESQuery struct { Invitee string Segments []string IsOrderMerchant bool + ImportHistory string + IsSetup string } // ESSort