fix conflict

This commit is contained in:
Nguyen Minh 2023-03-23 10:36:07 +07:00
commit 2c00022622
4 changed files with 46 additions and 0 deletions

21
client/socket.go Normal file
View File

@ -0,0 +1,21 @@
package client
import (
"git.selly.red/Selly-Modules/natsio"
"git.selly.red/Selly-Modules/natsio/model"
"git.selly.red/Selly-Modules/natsio/subject"
)
// Socket ...
type Socket struct{}
// GetSocket ...
func GetSocket() Socket {
return Socket{}
}
// EmitSocketEventDataReward ...
func (s Socket) EmitSocketEventDataReward(p model.PayloadEmitSocketEvent) error {
_, err := natsio.GetServer().Request(subject.Socket.EmitEventReward, toBytes(p))
return err
}

9
model/socket.go Normal file
View File

@ -0,0 +1,9 @@
package model
// PayloadEmitSocketEvent ...
type PayloadEmitSocketEvent struct {
User string `json:"user"`
Message string `json:"message"`
Data string `json:"data"`
IsNotRemove bool `json:"isNotRemove"`
}

View File

@ -23,6 +23,7 @@ var prefixes = struct {
Affiliate string Affiliate string
Product string Product string
Queue string Queue string
Socket string
}{ }{
Communication: "communication", Communication: "communication",
Order: "order", Order: "order",
@ -46,4 +47,5 @@ var prefixes = struct {
Affiliate: "affiliate", Affiliate: "affiliate",
Product: "product", Product: "product",
Queue: "queue", Queue: "queue",
Socket: "socket",
} }

14
subject/socket.go Normal file
View File

@ -0,0 +1,14 @@
package subject
import "fmt"
func getSocketValue(val string) string {
return fmt.Sprintf("%s.%s", prefixes.Socket, val)
}
// Socket ...
var Socket = struct {
EmitEventReward string
}{
EmitEventReward: getSocketValue("emit_event_reward"),
}