-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
42 lines (37 loc) · 966 Bytes
/
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
package main
import (
"context"
"github.com/gin-gonic/gin"
"github.com/go-leo/gors"
"github.com/go-leo/gors/example/api/tests/allofwrap"
"net"
"net/http"
)
func main() {
engine := gin.New()
engine = gors.AppendRoutes(engine, allofwrap.MessagingServiceRoutes(NewMessagingService())...)
srv := http.Server{Handler: engine}
listen, err := net.Listen("tcp", ":8089")
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 *allofwrap.Message) (*allofwrap.Message, error) {
return &allofwrap.Message{
Sub: message.GetSub(),
SubInput: nil,
SubOutput: message.GetSubInput(),
SubDesc: message.GetSubDesc(),
Subs: []*allofwrap.Message_Sub{message.GetSubInput()},
MessageId: message.GetMessageId(),
}, nil
}
func NewMessagingService() allofwrap.MessagingService {
return &MessagingService{}
}