From 661bb5bd2febf7141cf5a411bcd9635034a34b48 Mon Sep 17 00:00:00 2001 From: trunglt251292 Date: Wed, 30 Mar 2022 18:01:51 +0700 Subject: [PATCH 1/5] [Update] Nats version --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index f612c46..c5edf22 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,7 @@ module github.com/Selly-Modules/elasticsearch go 1.17 -require github.com/Selly-Modules/natsio v0.0.0-20220318042849-ee34e47598b7 +require github.com/Selly-Modules/natsio v0.0.0-20220330105528-1e3bfd73927d require ( github.com/logrusorgru/aurora v2.0.3+incompatible // indirect diff --git a/go.sum b/go.sum index c180bf0..12ae313 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,7 @@ github.com/Selly-Modules/natsio v0.0.0-20220318042849-ee34e47598b7 h1:t4kLJt+Q4U4m79Ms9S6zjmIfTXSyrzxzVwLU6nGrQOo= github.com/Selly-Modules/natsio v0.0.0-20220318042849-ee34e47598b7/go.mod h1:NG55g9ip18nvN5tfP6PcSEKec10/lOeIOZC8HqBVNlQ= +github.com/Selly-Modules/natsio v0.0.0-20220330105528-1e3bfd73927d h1:BtY+WFNqlz16xeYOqz97jghHylowTonJ9DLauOy/0bY= +github.com/Selly-Modules/natsio v0.0.0-20220330105528-1e3bfd73927d/go.mod h1:NG55g9ip18nvN5tfP6PcSEKec10/lOeIOZC8HqBVNlQ= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= From d82348ad804c8432a3555a831e20d37ef68891e6 Mon Sep 17 00:00:00 2001 From: trunglt251292 Date: Wed, 30 Mar 2022 19:17:59 +0700 Subject: [PATCH 2/5] [Add] Create index --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index c5edf22..dd180e1 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,7 @@ module github.com/Selly-Modules/elasticsearch go 1.17 -require github.com/Selly-Modules/natsio v0.0.0-20220330105528-1e3bfd73927d +require github.com/Selly-Modules/natsio v0.0.0-20220330121714-2a9897e137f8 require ( github.com/logrusorgru/aurora v2.0.3+incompatible // indirect diff --git a/go.sum b/go.sum index 12ae313..dff3d1a 100644 --- a/go.sum +++ b/go.sum @@ -2,6 +2,8 @@ github.com/Selly-Modules/natsio v0.0.0-20220318042849-ee34e47598b7 h1:t4kLJt+Q4U github.com/Selly-Modules/natsio v0.0.0-20220318042849-ee34e47598b7/go.mod h1:NG55g9ip18nvN5tfP6PcSEKec10/lOeIOZC8HqBVNlQ= github.com/Selly-Modules/natsio v0.0.0-20220330105528-1e3bfd73927d h1:BtY+WFNqlz16xeYOqz97jghHylowTonJ9DLauOy/0bY= github.com/Selly-Modules/natsio v0.0.0-20220330105528-1e3bfd73927d/go.mod h1:NG55g9ip18nvN5tfP6PcSEKec10/lOeIOZC8HqBVNlQ= +github.com/Selly-Modules/natsio v0.0.0-20220330121714-2a9897e137f8 h1:KbDjZorOkDgnPp8FaWG5XqChimLV7OseCcA52hQd+Lc= +github.com/Selly-Modules/natsio v0.0.0-20220330121714-2a9897e137f8/go.mod h1:NG55g9ip18nvN5tfP6PcSEKec10/lOeIOZC8HqBVNlQ= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= From eb2d9fe754ccfa3bbfea03b9e1dfe623162e89a4 Mon Sep 17 00:00:00 2001 From: trunglt251292 Date: Wed, 30 Mar 2022 19:46:42 +0700 Subject: [PATCH 3/5] [Update] Request nats --- constants.go | 30 ++++++++++++++++-------------- request.go | 21 ++++++++++++++++++--- 2 files changed, 34 insertions(+), 17 deletions(-) diff --git a/constants.go b/constants.go index 67631fd..6ffbd01 100644 --- a/constants.go +++ b/constants.go @@ -1,23 +1,25 @@ package elasticsearch const ( - SubjectRequestProductUpsert = "selly.request.product.upsert" - SubjectPullProductUpsert = "selly.pull.product.upsert" - SubjectRequestProductSearch = "selly.request.product.search" + SubjectRequestProductUpsert = "selly.request.product.upsert" + SubjectPullProductUpsert = "selly.pull.product.upsert" + SubjectRequestProductSearch = "selly.request.product.search" + SubjectRequestProductCreateIndex = "selly.request.product.create_index" - SubjectRequestOrderUpsert = "selly.request.order.upsert" - SubjectPullOrderUpsert = "selly.pull.order.upsert" - SubjectRequestOrderSearch = "selly.request.order.search" + SubjectRequestOrderUpsert = "selly.request.order.upsert" + SubjectPullOrderUpsert = "selly.pull.order.upsert" + SubjectRequestOrderSearch = "selly.request.order.search" + SubjectRequestOrderCreateIndex = "selly.request.order.create_index" - SubjectRequestUserUpsert = "selly.request.user.upsert" - SubjectPullUserUpsert = "selly.pull.user.upsert" - SubjectRequestUserSearch = "selly.request.user.search" + SubjectRequestKeywordUpsert = "selly.request.keyword.upsert" + SubjectPullKeywordUpsert = "selly.pull.keyword.upsert" + SubjectRequestKeywordSearch = "selly.request.keyword.search" + SubjectRequestKeywordCreateIndex = "selly.request.order.create_index" - SubjectRequestKeywordUpsert = "selly.request.keyword.upsert" - SubjectPullKeywordUpsert = "selly.pull.keyword.upsert" - SubjectRequestKeywordSearch = "selly.request.keyword.search" - - SubjectRequestCreateIndex = "selly.request.es.create_index" + SubjectRequestUserUpsert = "selly.request.user.upsert" + SubjectPullUserUpsert = "selly.pull.user.upsert" + SubjectRequestUserSearch = "selly.request.user.search" + SubjectRequestUserCreateIndex = "selly.request.user.create_index" ) const ( diff --git a/request.go b/request.go index 2a7e4bd..8a13a80 100644 --- a/request.go +++ b/request.go @@ -14,6 +14,11 @@ func (Request) ProductUpsert(payload Payload) (*Response, error) { return requestNats(SubjectRequestProductUpsert, toBytes(payload)) } +// ProductCreateIndex ... +func (Request) ProductCreateIndex() (*Response, error) { + return requestNats(SubjectRequestProductCreateIndex, toBytes(Payload{})) +} + // UserSearch ... func (Request) UserSearch(query ESQuery) (*Response, error) { return requestNats(SubjectRequestUserSearch, toBytes(query)) @@ -24,6 +29,11 @@ func (Request) UserUpsert(payload Payload) (*Response, error) { return requestNats(SubjectRequestUserUpsert, toBytes(payload)) } +// UserCreateIndex ... +func (Request) UserCreateIndex() (*Response, error) { + return requestNats(SubjectRequestUserCreateIndex, toBytes(Payload{})) +} + // OrderSearch ... func (Request) OrderSearch(query ESQuery) (*Response, error) { return requestNats(SubjectRequestOrderSearch, toBytes(query)) @@ -34,6 +44,11 @@ func (Request) OrderUpsert(payload Payload) (*Response, error) { return requestNats(SubjectRequestOrderUpsert, toBytes(payload)) } +// OrderCreateIndex ... +func (Request) OrderCreateIndex() (*Response, error) { + return requestNats(SubjectRequestOrderCreateIndex, toBytes(Payload{})) +} + // KeywordSearch ... func (Request) KeywordSearch(query ESQuery) (*Response, error) { return requestNats(SubjectRequestKeywordSearch, toBytes(query)) @@ -44,7 +59,7 @@ func (Request) KeywordUpsert(payload Payload) (*Response, error) { return requestNats(SubjectRequestKeywordUpsert, toBytes(payload)) } -// CreateIndex ... -func (Request) CreateIndex(payload Payload) (*Response, error) { - return requestNats(SubjectRequestCreateIndex, toBytes(payload)) +// KeywordCreateIndex ... +func (Request) KeywordCreateIndex() (*Response, error) { + return requestNats(SubjectRequestKeywordCreateIndex, toBytes(Payload{})) } From 68fefbfe248f4ada3e4b8011d653a936c46316d2 Mon Sep 17 00:00:00 2001 From: trunglt251292 Date: Wed, 30 Mar 2022 20:38:09 +0700 Subject: [PATCH 4/5] [Update] Request nats subject --- constants.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/constants.go b/constants.go index 6ffbd01..8e004ab 100644 --- a/constants.go +++ b/constants.go @@ -14,7 +14,7 @@ const ( SubjectRequestKeywordUpsert = "selly.request.keyword.upsert" SubjectPullKeywordUpsert = "selly.pull.keyword.upsert" SubjectRequestKeywordSearch = "selly.request.keyword.search" - SubjectRequestKeywordCreateIndex = "selly.request.order.create_index" + SubjectRequestKeywordCreateIndex = "selly.request.keyword.create_index" SubjectRequestUserUpsert = "selly.request.user.upsert" SubjectPullUserUpsert = "selly.pull.user.upsert" From 297782f089943fd9dbf68b1ef2a0d185c537e226 Mon Sep 17 00:00:00 2001 From: trunglt251292 Date: Fri, 1 Apr 2022 10:15:11 +0700 Subject: [PATCH 5/5] [Update] Delete multiple index --- constants.go | 2 ++ request.go | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/constants.go b/constants.go index 8e004ab..4001f1d 100644 --- a/constants.go +++ b/constants.go @@ -20,6 +20,8 @@ const ( SubjectPullUserUpsert = "selly.pull.user.upsert" SubjectRequestUserSearch = "selly.request.user.search" SubjectRequestUserCreateIndex = "selly.request.user.create_index" + + SubjectRequestDeleteMultipleIndex = "selly.request.delete.multiple_index" ) const ( diff --git a/request.go b/request.go index 8a13a80..d2f87a4 100644 --- a/request.go +++ b/request.go @@ -63,3 +63,8 @@ func (Request) KeywordUpsert(payload Payload) (*Response, error) { func (Request) KeywordCreateIndex() (*Response, error) { return requestNats(SubjectRequestKeywordCreateIndex, toBytes(Payload{})) } + +// DeleteMultipleIndex ... +func (Request) DeleteMultipleIndex(indexes []string) (*Response, error) { + return requestNats(SubjectRequestDeleteMultipleIndex, toBytes(indexes)) +}