[Update] Request nats

This commit is contained in:
trunglt251292 2022-03-30 19:46:42 +07:00
parent d82348ad80
commit eb2d9fe754
2 changed files with 34 additions and 17 deletions

View File

@ -4,20 +4,22 @@ const (
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"
SubjectRequestUserUpsert = "selly.request.user.upsert"
SubjectPullUserUpsert = "selly.pull.user.upsert"
SubjectRequestUserSearch = "selly.request.user.search"
SubjectRequestOrderCreateIndex = "selly.request.order.create_index"
SubjectRequestKeywordUpsert = "selly.request.keyword.upsert"
SubjectPullKeywordUpsert = "selly.pull.keyword.upsert"
SubjectRequestKeywordSearch = "selly.request.keyword.search"
SubjectRequestKeywordCreateIndex = "selly.request.order.create_index"
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 (

View File

@ -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{}))
}