commit
c8a1f992a6
30
constants.go
30
constants.go
|
@ -1,23 +1,27 @@
|
||||||
package elasticsearch
|
package elasticsearch
|
||||||
|
|
||||||
const (
|
const (
|
||||||
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"
|
||||||
|
SubjectRequestProductCreateIndex = "selly.request.product.create_index"
|
||||||
|
|
||||||
SubjectRequestOrderUpsert = "selly.request.order.upsert"
|
SubjectRequestOrderUpsert = "selly.request.order.upsert"
|
||||||
SubjectPullOrderUpsert = "selly.pull.order.upsert"
|
SubjectPullOrderUpsert = "selly.pull.order.upsert"
|
||||||
SubjectRequestOrderSearch = "selly.request.order.search"
|
SubjectRequestOrderSearch = "selly.request.order.search"
|
||||||
|
SubjectRequestOrderCreateIndex = "selly.request.order.create_index"
|
||||||
|
|
||||||
SubjectRequestUserUpsert = "selly.request.user.upsert"
|
SubjectRequestKeywordUpsert = "selly.request.keyword.upsert"
|
||||||
SubjectPullUserUpsert = "selly.pull.user.upsert"
|
SubjectPullKeywordUpsert = "selly.pull.keyword.upsert"
|
||||||
SubjectRequestUserSearch = "selly.request.user.search"
|
SubjectRequestKeywordSearch = "selly.request.keyword.search"
|
||||||
|
SubjectRequestKeywordCreateIndex = "selly.request.keyword.create_index"
|
||||||
|
|
||||||
SubjectRequestKeywordUpsert = "selly.request.keyword.upsert"
|
SubjectRequestUserUpsert = "selly.request.user.upsert"
|
||||||
SubjectPullKeywordUpsert = "selly.pull.keyword.upsert"
|
SubjectPullUserUpsert = "selly.pull.user.upsert"
|
||||||
SubjectRequestKeywordSearch = "selly.request.keyword.search"
|
SubjectRequestUserSearch = "selly.request.user.search"
|
||||||
|
SubjectRequestUserCreateIndex = "selly.request.user.create_index"
|
||||||
|
|
||||||
SubjectRequestCreateIndex = "selly.request.es.create_index"
|
SubjectRequestDeleteMultipleIndex = "selly.request.delete.multiple_index"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
2
go.mod
2
go.mod
|
@ -2,7 +2,7 @@ module github.com/Selly-Modules/elasticsearch
|
||||||
|
|
||||||
go 1.17
|
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 (
|
require (
|
||||||
github.com/logrusorgru/aurora v2.0.3+incompatible // indirect
|
github.com/logrusorgru/aurora v2.0.3+incompatible // indirect
|
||||||
|
|
4
go.sum
4
go.sum
|
@ -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 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-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 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
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=
|
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
|
||||||
|
|
26
request.go
26
request.go
|
@ -14,6 +14,11 @@ func (Request) ProductUpsert(payload Payload) (*Response, error) {
|
||||||
return requestNats(SubjectRequestProductUpsert, toBytes(payload))
|
return requestNats(SubjectRequestProductUpsert, toBytes(payload))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ProductCreateIndex ...
|
||||||
|
func (Request) ProductCreateIndex() (*Response, error) {
|
||||||
|
return requestNats(SubjectRequestProductCreateIndex, toBytes(Payload{}))
|
||||||
|
}
|
||||||
|
|
||||||
// UserSearch ...
|
// UserSearch ...
|
||||||
func (Request) UserSearch(query ESQuery) (*Response, error) {
|
func (Request) UserSearch(query ESQuery) (*Response, error) {
|
||||||
return requestNats(SubjectRequestUserSearch, toBytes(query))
|
return requestNats(SubjectRequestUserSearch, toBytes(query))
|
||||||
|
@ -24,6 +29,11 @@ func (Request) UserUpsert(payload Payload) (*Response, error) {
|
||||||
return requestNats(SubjectRequestUserUpsert, toBytes(payload))
|
return requestNats(SubjectRequestUserUpsert, toBytes(payload))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UserCreateIndex ...
|
||||||
|
func (Request) UserCreateIndex() (*Response, error) {
|
||||||
|
return requestNats(SubjectRequestUserCreateIndex, toBytes(Payload{}))
|
||||||
|
}
|
||||||
|
|
||||||
// OrderSearch ...
|
// OrderSearch ...
|
||||||
func (Request) OrderSearch(query ESQuery) (*Response, error) {
|
func (Request) OrderSearch(query ESQuery) (*Response, error) {
|
||||||
return requestNats(SubjectRequestOrderSearch, toBytes(query))
|
return requestNats(SubjectRequestOrderSearch, toBytes(query))
|
||||||
|
@ -34,6 +44,11 @@ func (Request) OrderUpsert(payload Payload) (*Response, error) {
|
||||||
return requestNats(SubjectRequestOrderUpsert, toBytes(payload))
|
return requestNats(SubjectRequestOrderUpsert, toBytes(payload))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// OrderCreateIndex ...
|
||||||
|
func (Request) OrderCreateIndex() (*Response, error) {
|
||||||
|
return requestNats(SubjectRequestOrderCreateIndex, toBytes(Payload{}))
|
||||||
|
}
|
||||||
|
|
||||||
// KeywordSearch ...
|
// KeywordSearch ...
|
||||||
func (Request) KeywordSearch(query ESQuery) (*Response, error) {
|
func (Request) KeywordSearch(query ESQuery) (*Response, error) {
|
||||||
return requestNats(SubjectRequestKeywordSearch, toBytes(query))
|
return requestNats(SubjectRequestKeywordSearch, toBytes(query))
|
||||||
|
@ -44,7 +59,12 @@ func (Request) KeywordUpsert(payload Payload) (*Response, error) {
|
||||||
return requestNats(SubjectRequestKeywordUpsert, toBytes(payload))
|
return requestNats(SubjectRequestKeywordUpsert, toBytes(payload))
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateIndex ...
|
// KeywordCreateIndex ...
|
||||||
func (Request) CreateIndex(payload Payload) (*Response, error) {
|
func (Request) KeywordCreateIndex() (*Response, error) {
|
||||||
return requestNats(SubjectRequestCreateIndex, toBytes(payload))
|
return requestNats(SubjectRequestKeywordCreateIndex, toBytes(Payload{}))
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteMultipleIndex ...
|
||||||
|
func (Request) DeleteMultipleIndex(indexes []string) (*Response, error) {
|
||||||
|
return requestNats(SubjectRequestDeleteMultipleIndex, toBytes(indexes))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue