[Update] struct query es

This commit is contained in:
trunglt251292 2022-08-22 10:06:29 +07:00
parent ce72c5673c
commit 4b7175bd2b
3 changed files with 25 additions and 0 deletions

View File

@ -6,6 +6,11 @@ const (
SubjectRequestProductSkuSearch = "selly.request.product_sku.search" SubjectRequestProductSkuSearch = "selly.request.product_sku.search"
SubjectRequestProductSkuCreateIndex = "selly.request.product_sku.create_index" 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" SubjectRequestProductUpsert = "selly.request.product.upsert"
SubjectPullProductUpsert = "selly.pull.product.upsert" SubjectPullProductUpsert = "selly.pull.product.upsert"
SubjectRequestProductSearch = "selly.request.product.search" SubjectRequestProductSearch = "selly.request.product.search"

View File

@ -28,3 +28,8 @@ func (Pull) KeywordUpsert(payload Payload) (bool, error) {
func (Pull) ProductSkuUpsert(payload Payload) (bool, error) { func (Pull) ProductSkuUpsert(payload Payload) (bool, error) {
return publishWithJetStream(JetStreamSearchService, SubjectPullProductSkuUpsert, toBytes(payload)) return publishWithJetStream(JetStreamSearchService, SubjectPullProductSkuUpsert, toBytes(payload))
} }
// ProductShopUpsert ...
func (Pull) ProductShopUpsert(payload Payload) (bool, error) {
return publishWithJetStream(JetStreamSearchService, SubjectPullShopProductUpsert, toBytes(payload))
}

View File

@ -4,6 +4,21 @@ package elasticsearch
type Request struct { 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 ... // ProductSkuSearch ...
func (Request) ProductSkuSearch(query ESQuery) (*Response, error) { func (Request) ProductSkuSearch(query ESQuery) (*Response, error) {
return requestNats(SubjectRequestProductSkuSearch, toBytes(query)) return requestNats(SubjectRequestProductSkuSearch, toBytes(query))