[Update] Param name
This commit is contained in:
parent
5e7a5ee2c7
commit
3f6d5d14f5
18
constants.go
18
constants.go
|
@ -1,17 +1,17 @@
|
|||
package elasticsearch
|
||||
|
||||
const (
|
||||
SubjectRequestProductUpsert = "elasticsearch/selly.request.product.upsert"
|
||||
SubjectPullProductUpsert = "elasticsearch/selly.pull.product.upsert"
|
||||
SubjectRequestProductSearch = "elasticsearch/selly.request.product.search"
|
||||
SubjectRequestProductUpsert = "selly.request.product.upsert"
|
||||
SubjectPullProductUpsert = "selly.pull.product.upsert"
|
||||
SubjectRequestProductSearch = "selly.request.product.search"
|
||||
|
||||
SubjectRequestOrderUpsert = "elasticsearch/selly.request.order.upsert"
|
||||
SubjectPullOrderUpsert = "elasticsearch/selly.pull.order.upsert"
|
||||
SubjectRequestOrderSearch = "elasticsearch/selly.request.order.search"
|
||||
SubjectRequestOrderUpsert = "selly.request.order.upsert"
|
||||
SubjectPullOrderUpsert = "selly.pull.order.upsert"
|
||||
SubjectRequestOrderSearch = "selly.request.order.search"
|
||||
|
||||
SubjectRequestUserUpsert = "elasticsearch/selly.request.order.upsert"
|
||||
SubjectPullUserUpsert = "elasticsearch/selly.pull.order.upsert"
|
||||
SubjectRequestUserSearch = "elasticsearch/selly.request.user.search"
|
||||
SubjectRequestUserUpsert = "selly.request.user.upsert"
|
||||
SubjectPullUserUpsert = "selly.pull.user.upsert"
|
||||
SubjectRequestUserSearch = "selly.request.user.search"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
12
pull.go
12
pull.go
|
@ -5,16 +5,16 @@ type Pull struct {
|
|||
}
|
||||
|
||||
// ProductUpsert ...
|
||||
func (Pull) ProductUpsert(query UpdateDataPayload) (bool, error) {
|
||||
return publishWithJetStream(JetStreamSearchService, SubjectPullProductUpsert, toBytes(query))
|
||||
func (Pull) ProductUpsert(payload Payload) (bool, error) {
|
||||
return publishWithJetStream(JetStreamSearchService, SubjectPullProductUpsert, toBytes(payload))
|
||||
}
|
||||
|
||||
// UserUpsert ...
|
||||
func (Pull) UserUpsert(query UpdateDataPayload) (bool, error) {
|
||||
return publishWithJetStream(JetStreamSearchService, SubjectPullUserUpsert, toBytes(query))
|
||||
func (Pull) UserUpsert(payload Payload) (bool, error) {
|
||||
return publishWithJetStream(JetStreamSearchService, SubjectPullUserUpsert, toBytes(payload))
|
||||
}
|
||||
|
||||
// OrderUpsert ...
|
||||
func (Pull) OrderUpsert(query UpdateDataPayload) (bool, error) {
|
||||
return publishWithJetStream(JetStreamSearchService, SubjectPullOrderUpsert, toBytes(query))
|
||||
func (Pull) OrderUpsert(payload Payload) (bool, error) {
|
||||
return publishWithJetStream(JetStreamSearchService, SubjectPullOrderUpsert, toBytes(payload))
|
||||
}
|
||||
|
|
12
request.go
12
request.go
|
@ -10,8 +10,8 @@ func (Request) ProductSearch(query ESQuery) (*Response, error) {
|
|||
}
|
||||
|
||||
// ProductUpsert ...
|
||||
func (Request) ProductUpsert(query UpdateDataPayload) (*Response, error) {
|
||||
return requestNats(SubjectRequestProductUpsert, toBytes(query))
|
||||
func (Request) ProductUpsert(payload Payload) (*Response, error) {
|
||||
return requestNats(SubjectRequestProductUpsert, toBytes(payload))
|
||||
}
|
||||
|
||||
// UserSearch ...
|
||||
|
@ -20,8 +20,8 @@ func (Request) UserSearch(query ESQuery) (*Response, error) {
|
|||
}
|
||||
|
||||
// UserUpsert ...
|
||||
func (Request) UserUpsert(query UpdateDataPayload) (*Response, error) {
|
||||
return requestNats(SubjectRequestUserUpsert, toBytes(query))
|
||||
func (Request) UserUpsert(payload Payload) (*Response, error) {
|
||||
return requestNats(SubjectRequestUserUpsert, toBytes(payload))
|
||||
}
|
||||
|
||||
// OrderSearch ...
|
||||
|
@ -30,6 +30,6 @@ func (Request) OrderSearch(query ESQuery) (*Response, error) {
|
|||
}
|
||||
|
||||
// OrderUpsert ...
|
||||
func (Request) OrderUpsert(query UpdateDataPayload) (*Response, error) {
|
||||
return requestNats(SubjectRequestOrderUpsert, toBytes(query))
|
||||
func (Request) OrderUpsert(payload Payload) (*Response, error) {
|
||||
return requestNats(SubjectRequestOrderUpsert, toBytes(payload))
|
||||
}
|
||||
|
|
13
struct.go
13
struct.go
|
@ -19,20 +19,13 @@ type Response struct {
|
|||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
// SyncData
|
||||
// Payload for sync data to service es
|
||||
type SyncData struct {
|
||||
// Payload ...
|
||||
// payload for sync data to service es
|
||||
type Payload struct {
|
||||
Index string
|
||||
Data []byte
|
||||
}
|
||||
|
||||
// UpdateDataPayload
|
||||
// Payload for insert or update document
|
||||
type UpdateDataPayload struct {
|
||||
Index string
|
||||
Body []byte
|
||||
}
|
||||
|
||||
// DeleteDataPayload
|
||||
// Payload for delete document
|
||||
type DeleteDataPayload struct {
|
||||
|
|
Loading…
Reference in New Issue