-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
45 lines (40 loc) · 1.12 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package main
import (
"context"
"github.com/gin-gonic/gin"
"github.com/go-leo/gors"
"github.com/go-leo/gors/example/api/tests/mapfields"
"net"
"net/http"
)
func main() {
engine := gin.New()
engine = gors.AppendRoutes(engine, mapfields.MessagingServiceRoutes(NewMessagingService())...)
srv := http.Server{Handler: engine}
listen, err := net.Listen("tcp", ":8093")
if err != nil {
panic(err)
}
err = srv.Serve(listen)
if err != nil {
panic(err)
}
}
type MessagingService struct {
}
func (m MessagingService) UpdateMessage(ctx context.Context, message *mapfields.Message) (*mapfields.Message, error) {
return &mapfields.Message{
MessageId: message.GetMessageId(),
AnotherMessage: message.GetAnotherMessage(),
SubMessage: message.GetSubMessage(),
StringList: message.GetStringList(),
SubMessageList: message.GetSubMessageList(),
ObjectList: message.GetObjectList(),
StringsMap: message.GetStringsMap(),
SubMessagesMap: message.GetSubMessagesMap(),
ObjectsMap: message.GetObjectsMap(),
}, nil
}
func NewMessagingService() mapfields.MessagingService {
return &MessagingService{}
}