Merge pull request #13 from Selly-Modules/update-struct-query

Update struct query
This commit is contained in:
trunglt251292 2022-08-22 10:07:09 +07:00 committed by GitHub
commit 3c3d09940c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 27 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))

View File

@ -43,6 +43,8 @@ type ESQuery struct {
Keyword string Keyword string
ProvinceCode int ProvinceCode int
Active string Active string
Display string
ShopID string
IsOutOfStock string IsOutOfStock string
CanIssueInvoice string CanIssueInvoice string
PendingInactive string PendingInactive string