Merge pull request #7 from Selly-Modules/v1

V1
This commit is contained in:
trunglt251292 2022-04-18 14:41:38 +07:00 committed by GitHub
commit c8a1f992a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 45 additions and 17 deletions

View File

@ -4,20 +4,24 @@ 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.keyword.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"
SubjectRequestDeleteMultipleIndex = "selly.request.delete.multiple_index"
)
const (

2
go.mod
View File

@ -2,7 +2,7 @@ module github.com/Selly-Modules/elasticsearch
go 1.17
require github.com/Selly-Modules/natsio v0.0.0-20220318042849-ee34e47598b7
require github.com/Selly-Modules/natsio v0.0.0-20220330121714-2a9897e137f8
require (
github.com/logrusorgru/aurora v2.0.3+incompatible // indirect

4
go.sum
View File

@ -1,5 +1,9 @@
github.com/Selly-Modules/natsio v0.0.0-20220318042849-ee34e47598b7 h1:t4kLJt+Q4U4m79Ms9S6zjmIfTXSyrzxzVwLU6nGrQOo=
github.com/Selly-Modules/natsio v0.0.0-20220318042849-ee34e47598b7/go.mod h1:NG55g9ip18nvN5tfP6PcSEKec10/lOeIOZC8HqBVNlQ=
github.com/Selly-Modules/natsio v0.0.0-20220330105528-1e3bfd73927d h1:BtY+WFNqlz16xeYOqz97jghHylowTonJ9DLauOy/0bY=
github.com/Selly-Modules/natsio v0.0.0-20220330105528-1e3bfd73927d/go.mod h1:NG55g9ip18nvN5tfP6PcSEKec10/lOeIOZC8HqBVNlQ=
github.com/Selly-Modules/natsio v0.0.0-20220330121714-2a9897e137f8 h1:KbDjZorOkDgnPp8FaWG5XqChimLV7OseCcA52hQd+Lc=
github.com/Selly-Modules/natsio v0.0.0-20220330121714-2a9897e137f8/go.mod h1:NG55g9ip18nvN5tfP6PcSEKec10/lOeIOZC8HqBVNlQ=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=

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,12 @@ 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{}))
}
// DeleteMultipleIndex ...
func (Request) DeleteMultipleIndex(indexes []string) (*Response, error) {
return requestNats(SubjectRequestDeleteMultipleIndex, toBytes(indexes))
}