From f81c6237f75b03098bcdb936582db8bb1fa65679 Mon Sep 17 00:00:00 2001 From: trunglt251292 Date: Thu, 24 Mar 2022 10:26:23 +0700 Subject: [PATCH] Add keyword subject --- constants.go | 4 ++++ pull.go | 5 +++++ request.go | 10 ++++++++++ 3 files changed, 19 insertions(+) diff --git a/constants.go b/constants.go index 16ebb38..3239e26 100644 --- a/constants.go +++ b/constants.go @@ -12,6 +12,10 @@ const ( 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" ) const ( diff --git a/pull.go b/pull.go index fe354bc..9ec9170 100644 --- a/pull.go +++ b/pull.go @@ -18,3 +18,8 @@ func (Pull) UserUpsert(payload Payload) (bool, error) { func (Pull) OrderUpsert(payload Payload) (bool, error) { return publishWithJetStream(JetStreamSearchService, SubjectPullOrderUpsert, toBytes(payload)) } + +// KeywordUpsert ... +func (Pull) KeywordUpsert(payload Payload) (bool, error) { + return publishWithJetStream(JetStreamSearchService, SubjectPullKeywordUpsert, toBytes(payload)) +} diff --git a/request.go b/request.go index 3693532..743cf1a 100644 --- a/request.go +++ b/request.go @@ -33,3 +33,13 @@ func (Request) OrderSearch(query ESQuery) (*Response, error) { func (Request) OrderUpsert(payload Payload) (*Response, error) { 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)) +}