Add keyword subject

This commit is contained in:
trunglt251292 2022-03-24 10:26:23 +07:00
parent 5b760449fc
commit f81c6237f7
3 changed files with 19 additions and 0 deletions

View File

@ -12,6 +12,10 @@ const (
SubjectRequestUserUpsert = "selly.request.user.upsert" SubjectRequestUserUpsert = "selly.request.user.upsert"
SubjectPullUserUpsert = "selly.pull.user.upsert" SubjectPullUserUpsert = "selly.pull.user.upsert"
SubjectRequestUserSearch = "selly.request.user.search" SubjectRequestUserSearch = "selly.request.user.search"
SubjectRequestKeywordUpsert = "selly.request.keyword.upsert"
SubjectPullKeywordUpsert = "selly.pull.keyword.upsert"
SubjectRequestKeywordSearch = "selly.request.keyword.search"
) )
const ( const (

View File

@ -18,3 +18,8 @@ func (Pull) UserUpsert(payload Payload) (bool, error) {
func (Pull) OrderUpsert(payload Payload) (bool, error) { func (Pull) OrderUpsert(payload Payload) (bool, error) {
return publishWithJetStream(JetStreamSearchService, SubjectPullOrderUpsert, toBytes(payload)) return publishWithJetStream(JetStreamSearchService, SubjectPullOrderUpsert, toBytes(payload))
} }
// KeywordUpsert ...
func (Pull) KeywordUpsert(payload Payload) (bool, error) {
return publishWithJetStream(JetStreamSearchService, SubjectPullKeywordUpsert, toBytes(payload))
}

View File

@ -33,3 +33,13 @@ func (Request) OrderSearch(query ESQuery) (*Response, error) {
func (Request) OrderUpsert(payload Payload) (*Response, error) { func (Request) OrderUpsert(payload Payload) (*Response, error) {
return requestNats(SubjectRequestOrderUpsert, toBytes(payload)) return requestNats(SubjectRequestOrderUpsert, toBytes(payload))
} }
// KeywordSearch ...
func (Request) KeywordSearch(query ESQuery) (*Response, error) {
return requestNats(SubjectRequestKeywordSearch, toBytes(query))
}
// KeywordUpsert ...
func (Request) KeywordUpsert(payload Payload) (*Response, error) {
return requestNats(SubjectRequestKeywordUpsert, toBytes(payload))
}