add graph

This commit is contained in:
Владимир Фёдоров 2025-09-23 03:04:20 +07:00
parent 9b7241031c
commit c144123cff
10 changed files with 1071 additions and 1486 deletions

View File

@ -77,6 +77,12 @@ service EveningDetective {
get: "/teams/pdf" get: "/teams/pdf"
}; };
} }
rpc GetGraph(GetGraphReq) returns (GetGraphRsp) {
option (google.api.http) = {
get: "/graph"
};
}
} }
message PingReq {} message PingReq {}
@ -179,3 +185,20 @@ message DownloadTeamsQrCodesFileReq {}
message DownloadTeamsQrCodesFileRsp { message DownloadTeamsQrCodesFileRsp {
bytes result = 1; bytes result = 1;
} }
message GetGraphReq {}
message GetGraphRsp {
repeated Node nodes = 1;
repeated Edge edges = 2;
message Node {
int32 id = 1;
string label = 2;
}
message Edge {
int32 from = 1;
int32 to = 2;
string arrows = 3;
}
}

File diff suppressed because one or more lines are too long

28
go.mod
View File

@ -1,17 +1,23 @@
module evening_detective module evening_detective
go 1.23 go 1.23.0
toolchain go1.23.10 toolchain go1.24.5
require ( require (
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2
google.golang.org/grpc v1.64.0 google.golang.org/grpc v1.75.0
) )
require ( require (
github.com/ghodss/yaml v1.0.0 // indirect
github.com/golang/glog v1.2.5 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
github.com/phpdave11/gofpdi v1.0.14-0.20211212211723-1f10f9844311 // indirect github.com/phpdave11/gofpdi v1.0.14-0.20211212211723-1f10f9844311 // indirect
github.com/pkg/errors v0.8.1 // indirect github.com/pkg/errors v0.8.1 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
gopkg.in/yaml.v2 v2.2.3 // indirect
) )
require ( require (
@ -27,10 +33,12 @@ require (
github.com/mattn/go-sqlite3 v1.14.28 github.com/mattn/go-sqlite3 v1.14.28
github.com/signintech/gopdf v0.32.0 github.com/signintech/gopdf v0.32.0
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e
golang.org/x/net v0.23.0 // indirect golang.org/x/net v0.41.0 // indirect
golang.org/x/sys v0.26.0 // indirect golang.org/x/sys v0.33.0 // indirect
golang.org/x/text v0.15.0 // indirect golang.org/x/text v0.28.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240513163218-0867130af1f8 google.golang.org/genproto/googleapis/api v0.0.0-20250818200422-3122310a409c // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240513163218-0867130af1f8 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20250818200422-3122310a409c // indirect
google.golang.org/protobuf v1.34.1 google.golang.org/protobuf v1.36.7 // indirect
) )
tool github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway

View File

@ -63,3 +63,7 @@ func (s *Server) GiveApplications(ctx context.Context, req *proto.GiveApplicatio
func (s *Server) DownloadTeamsQrCodesFile(ctx context.Context, req *proto.DownloadTeamsQrCodesFileReq) (*proto.DownloadTeamsQrCodesFileRsp, error) { func (s *Server) DownloadTeamsQrCodesFile(ctx context.Context, req *proto.DownloadTeamsQrCodesFileReq) (*proto.DownloadTeamsQrCodesFileRsp, error) {
return s.services.DownloadTeamsQrCodesFile(ctx, req) return s.services.DownloadTeamsQrCodesFile(ctx, req)
} }
func (s *Server) GetGraph(ctx context.Context, req *proto.GetGraphReq) (*proto.GetGraphRsp, error) {
return s.services.GetGraph(ctx, req)
}

View File

@ -200,6 +200,29 @@ func (s *Services) DownloadTeamsQrCodesFile(ctx context.Context, req *proto.Down
return &proto.DownloadTeamsQrCodesFileRsp{Result: b}, nil return &proto.DownloadTeamsQrCodesFileRsp{Result: b}, nil
} }
func (s *Services) GetGraph(ctx context.Context, req *proto.GetGraphReq) (*proto.GetGraphRsp, error) {
graph := s.storyService.GetGraph(ctx)
nodes := make([]*proto.GetGraphRsp_Node, 0, len(graph.Nodes))
for _, node := range graph.Nodes {
nodes = append(nodes, &proto.GetGraphRsp_Node{
Id: node.ID,
Label: node.Label,
})
}
edges := make([]*proto.GetGraphRsp_Edge, 0, len(graph.Edges))
for _, edge := range graph.Edges {
edges = append(edges, &proto.GetGraphRsp_Edge{
From: edge.From,
To: edge.To,
Arrows: "to",
})
}
return &proto.GetGraphRsp{
Nodes: nodes,
Edges: edges,
}, nil
}
func (s *Services) getTeam(ctx context.Context) (*models.Team, error) { func (s *Services) getTeam(ctx context.Context) (*models.Team, error) {
md, ok := metadata.FromIncomingContext(ctx) md, ok := metadata.FromIncomingContext(ctx)
if !ok { if !ok {

View File

@ -1,10 +1,12 @@
package story_service package story_service
import ( import (
"context"
"encoding/json" "encoding/json"
"fmt" "fmt"
"log" "log"
"os" "os"
"regexp"
"strings" "strings"
) )
@ -37,6 +39,21 @@ type Place struct {
Applications []*Application `json:"applications"` Applications []*Application `json:"applications"`
} }
type Graph struct {
Nodes []*Node
Edges []*Edge
}
type Node struct {
ID int32
Label string
}
type Edge struct {
From int32
To int32
}
type Application struct { type Application struct {
Name string `json:"name"` Name string `json:"name"`
} }
@ -69,6 +86,8 @@ func (s *StoryService) GetPlace(code string) *Place {
code = clearCode(code) code = clearCode(code)
for _, place := range s.story.Places { for _, place := range s.story.Places {
if clearCode(place.Code) == code { if clearCode(place.Code) == code {
re := regexp.MustCompile(`\(\[[a-zA-Zа-яА-Я\d-]+\]\)`)
place.Text = re.ReplaceAllString(place.Text, "")
return place return place
} }
} }
@ -79,6 +98,41 @@ func (s *StoryService) GetPlace(code string) *Place {
} }
} }
func (s *StoryService) GetGraph(ctx context.Context) *Graph {
m := make(map[string]int32, len(s.story.Places))
nodes := make([]*Node, 0, len(s.story.Places))
for i, place := range s.story.Places {
m[clearCode(place.Code)] = int32(i)
nodes = append(nodes, &Node{ID: int32(i), Label: place.Code})
}
edges := make([]*Edge, 0, len(s.story.Places)*3)
for _, place := range s.story.Places {
re := regexp.MustCompile(`\(\[[a-zA-Zа-яА-Я\d-]+\]\)`)
matches := re.FindAllString(place.Text, -1)
for _, match := range matches {
edges = append(edges, &Edge{
From: m[clearCode(place.Code)],
To: m[clearMatch(match)],
})
}
}
return &Graph{
Nodes: nodes,
Edges: edges,
}
}
func clearMatch(s string) string {
s = strings.TrimPrefix(s, "(")
s = strings.TrimPrefix(s, "[")
s = strings.TrimSuffix(s, ")")
s = strings.TrimSuffix(s, "]")
return clearCode(s)
}
func clearCode(code string) string { func clearCode(code string) string {
code = strings.ToLower(code) code = strings.ToLower(code)
code = strings.TrimSpace(code) code = strings.TrimSpace(code)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -119,6 +119,28 @@
] ]
} }
}, },
"/graph": {
"get": {
"operationId": "EveningDetective_GetGraph",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/evening_detectiveGetGraphRsp"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/runtimeError"
}
}
},
"tags": [
"EveningDetective"
]
}
},
"/ping": { "/ping": {
"get": { "get": {
"operationId": "EveningDetective_Ping", "operationId": "EveningDetective_Ping",
@ -310,6 +332,34 @@
} }
}, },
"definitions": { "definitions": {
"GetGraphRspEdge": {
"type": "object",
"properties": {
"from": {
"type": "integer",
"format": "int32"
},
"to": {
"type": "integer",
"format": "int32"
},
"arrows": {
"type": "string"
}
}
},
"GetGraphRspNode": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int32"
},
"label": {
"type": "string"
}
}
},
"evening_detectiveAction": { "evening_detectiveAction": {
"type": "object", "type": "object",
"properties": { "properties": {
@ -423,6 +473,23 @@
} }
} }
}, },
"evening_detectiveGetGraphRsp": {
"type": "object",
"properties": {
"nodes": {
"type": "array",
"items": {
"$ref": "#/definitions/GetGraphRspNode"
}
},
"edges": {
"type": "array",
"items": {
"$ref": "#/definitions/GetGraphRspEdge"
}
}
}
},
"evening_detectiveGetTeamRsp": { "evening_detectiveGetTeamRsp": {
"type": "object", "type": "object",
"properties": { "properties": {

View File

@ -1,7 +1,7 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT. // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions: // versions:
// - protoc-gen-go-grpc v1.3.0 // - protoc-gen-go-grpc v1.5.1
// - protoc v5.26.1 // - protoc v6.32.1
// source: main.proto // source: main.proto
package proto package proto
@ -15,8 +15,8 @@ import (
// This is a compile-time assertion to ensure that this generated file // This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against. // is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later. // Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion7 const _ = grpc.SupportPackageIsVersion9
const ( const (
EveningDetective_Ping_FullMethodName = "/crabs.evening_detective.EveningDetective/Ping" EveningDetective_Ping_FullMethodName = "/crabs.evening_detective.EveningDetective/Ping"
@ -30,6 +30,7 @@ const (
EveningDetective_GameStop_FullMethodName = "/crabs.evening_detective.EveningDetective/GameStop" EveningDetective_GameStop_FullMethodName = "/crabs.evening_detective.EveningDetective/GameStop"
EveningDetective_GiveApplications_FullMethodName = "/crabs.evening_detective.EveningDetective/GiveApplications" EveningDetective_GiveApplications_FullMethodName = "/crabs.evening_detective.EveningDetective/GiveApplications"
EveningDetective_DownloadTeamsQrCodesFile_FullMethodName = "/crabs.evening_detective.EveningDetective/DownloadTeamsQrCodesFile" EveningDetective_DownloadTeamsQrCodesFile_FullMethodName = "/crabs.evening_detective.EveningDetective/DownloadTeamsQrCodesFile"
EveningDetective_GetGraph_FullMethodName = "/crabs.evening_detective.EveningDetective/GetGraph"
) )
// EveningDetectiveClient is the client API for EveningDetective service. // EveningDetectiveClient is the client API for EveningDetective service.
@ -47,6 +48,7 @@ type EveningDetectiveClient interface {
GameStop(ctx context.Context, in *GameStopReq, opts ...grpc.CallOption) (*GameStopRsp, error) GameStop(ctx context.Context, in *GameStopReq, opts ...grpc.CallOption) (*GameStopRsp, error)
GiveApplications(ctx context.Context, in *GiveApplicationsReq, opts ...grpc.CallOption) (*GiveApplicationsRsp, error) GiveApplications(ctx context.Context, in *GiveApplicationsReq, opts ...grpc.CallOption) (*GiveApplicationsRsp, error)
DownloadTeamsQrCodesFile(ctx context.Context, in *DownloadTeamsQrCodesFileReq, opts ...grpc.CallOption) (*DownloadTeamsQrCodesFileRsp, error) DownloadTeamsQrCodesFile(ctx context.Context, in *DownloadTeamsQrCodesFileReq, opts ...grpc.CallOption) (*DownloadTeamsQrCodesFileRsp, error)
GetGraph(ctx context.Context, in *GetGraphReq, opts ...grpc.CallOption) (*GetGraphRsp, error)
} }
type eveningDetectiveClient struct { type eveningDetectiveClient struct {
@ -58,8 +60,9 @@ func NewEveningDetectiveClient(cc grpc.ClientConnInterface) EveningDetectiveClie
} }
func (c *eveningDetectiveClient) Ping(ctx context.Context, in *PingReq, opts ...grpc.CallOption) (*PingRsp, error) { func (c *eveningDetectiveClient) Ping(ctx context.Context, in *PingReq, opts ...grpc.CallOption) (*PingRsp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(PingRsp) out := new(PingRsp)
err := c.cc.Invoke(ctx, EveningDetective_Ping_FullMethodName, in, out, opts...) err := c.cc.Invoke(ctx, EveningDetective_Ping_FullMethodName, in, out, cOpts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -67,8 +70,9 @@ func (c *eveningDetectiveClient) Ping(ctx context.Context, in *PingReq, opts ...
} }
func (c *eveningDetectiveClient) AddTeams(ctx context.Context, in *AddTeamsReq, opts ...grpc.CallOption) (*AddTeamsRsp, error) { func (c *eveningDetectiveClient) AddTeams(ctx context.Context, in *AddTeamsReq, opts ...grpc.CallOption) (*AddTeamsRsp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(AddTeamsRsp) out := new(AddTeamsRsp)
err := c.cc.Invoke(ctx, EveningDetective_AddTeams_FullMethodName, in, out, opts...) err := c.cc.Invoke(ctx, EveningDetective_AddTeams_FullMethodName, in, out, cOpts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -76,8 +80,9 @@ func (c *eveningDetectiveClient) AddTeams(ctx context.Context, in *AddTeamsReq,
} }
func (c *eveningDetectiveClient) GetTeams(ctx context.Context, in *GetTeamsReq, opts ...grpc.CallOption) (*GetTeamsRsp, error) { func (c *eveningDetectiveClient) GetTeams(ctx context.Context, in *GetTeamsReq, opts ...grpc.CallOption) (*GetTeamsRsp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetTeamsRsp) out := new(GetTeamsRsp)
err := c.cc.Invoke(ctx, EveningDetective_GetTeams_FullMethodName, in, out, opts...) err := c.cc.Invoke(ctx, EveningDetective_GetTeams_FullMethodName, in, out, cOpts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -85,8 +90,9 @@ func (c *eveningDetectiveClient) GetTeams(ctx context.Context, in *GetTeamsReq,
} }
func (c *eveningDetectiveClient) GetTeamsCSV(ctx context.Context, in *GetTeamsCSVReq, opts ...grpc.CallOption) (*GetTeamsCSVRsp, error) { func (c *eveningDetectiveClient) GetTeamsCSV(ctx context.Context, in *GetTeamsCSVReq, opts ...grpc.CallOption) (*GetTeamsCSVRsp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetTeamsCSVRsp) out := new(GetTeamsCSVRsp)
err := c.cc.Invoke(ctx, EveningDetective_GetTeamsCSV_FullMethodName, in, out, opts...) err := c.cc.Invoke(ctx, EveningDetective_GetTeamsCSV_FullMethodName, in, out, cOpts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -94,8 +100,9 @@ func (c *eveningDetectiveClient) GetTeamsCSV(ctx context.Context, in *GetTeamsCS
} }
func (c *eveningDetectiveClient) GetTeam(ctx context.Context, in *GetTeamReq, opts ...grpc.CallOption) (*GetTeamRsp, error) { func (c *eveningDetectiveClient) GetTeam(ctx context.Context, in *GetTeamReq, opts ...grpc.CallOption) (*GetTeamRsp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetTeamRsp) out := new(GetTeamRsp)
err := c.cc.Invoke(ctx, EveningDetective_GetTeam_FullMethodName, in, out, opts...) err := c.cc.Invoke(ctx, EveningDetective_GetTeam_FullMethodName, in, out, cOpts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -103,8 +110,9 @@ func (c *eveningDetectiveClient) GetTeam(ctx context.Context, in *GetTeamReq, op
} }
func (c *eveningDetectiveClient) AddAction(ctx context.Context, in *AddActionReq, opts ...grpc.CallOption) (*AddActionRsp, error) { func (c *eveningDetectiveClient) AddAction(ctx context.Context, in *AddActionReq, opts ...grpc.CallOption) (*AddActionRsp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(AddActionRsp) out := new(AddActionRsp)
err := c.cc.Invoke(ctx, EveningDetective_AddAction_FullMethodName, in, out, opts...) err := c.cc.Invoke(ctx, EveningDetective_AddAction_FullMethodName, in, out, cOpts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -112,8 +120,9 @@ func (c *eveningDetectiveClient) AddAction(ctx context.Context, in *AddActionReq
} }
func (c *eveningDetectiveClient) GetGame(ctx context.Context, in *GetGameReq, opts ...grpc.CallOption) (*GetGameRsp, error) { func (c *eveningDetectiveClient) GetGame(ctx context.Context, in *GetGameReq, opts ...grpc.CallOption) (*GetGameRsp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetGameRsp) out := new(GetGameRsp)
err := c.cc.Invoke(ctx, EveningDetective_GetGame_FullMethodName, in, out, opts...) err := c.cc.Invoke(ctx, EveningDetective_GetGame_FullMethodName, in, out, cOpts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -121,8 +130,9 @@ func (c *eveningDetectiveClient) GetGame(ctx context.Context, in *GetGameReq, op
} }
func (c *eveningDetectiveClient) GameStart(ctx context.Context, in *GameStartReq, opts ...grpc.CallOption) (*GameStartRsp, error) { func (c *eveningDetectiveClient) GameStart(ctx context.Context, in *GameStartReq, opts ...grpc.CallOption) (*GameStartRsp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GameStartRsp) out := new(GameStartRsp)
err := c.cc.Invoke(ctx, EveningDetective_GameStart_FullMethodName, in, out, opts...) err := c.cc.Invoke(ctx, EveningDetective_GameStart_FullMethodName, in, out, cOpts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -130,8 +140,9 @@ func (c *eveningDetectiveClient) GameStart(ctx context.Context, in *GameStartReq
} }
func (c *eveningDetectiveClient) GameStop(ctx context.Context, in *GameStopReq, opts ...grpc.CallOption) (*GameStopRsp, error) { func (c *eveningDetectiveClient) GameStop(ctx context.Context, in *GameStopReq, opts ...grpc.CallOption) (*GameStopRsp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GameStopRsp) out := new(GameStopRsp)
err := c.cc.Invoke(ctx, EveningDetective_GameStop_FullMethodName, in, out, opts...) err := c.cc.Invoke(ctx, EveningDetective_GameStop_FullMethodName, in, out, cOpts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -139,8 +150,9 @@ func (c *eveningDetectiveClient) GameStop(ctx context.Context, in *GameStopReq,
} }
func (c *eveningDetectiveClient) GiveApplications(ctx context.Context, in *GiveApplicationsReq, opts ...grpc.CallOption) (*GiveApplicationsRsp, error) { func (c *eveningDetectiveClient) GiveApplications(ctx context.Context, in *GiveApplicationsReq, opts ...grpc.CallOption) (*GiveApplicationsRsp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GiveApplicationsRsp) out := new(GiveApplicationsRsp)
err := c.cc.Invoke(ctx, EveningDetective_GiveApplications_FullMethodName, in, out, opts...) err := c.cc.Invoke(ctx, EveningDetective_GiveApplications_FullMethodName, in, out, cOpts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -148,8 +160,19 @@ func (c *eveningDetectiveClient) GiveApplications(ctx context.Context, in *GiveA
} }
func (c *eveningDetectiveClient) DownloadTeamsQrCodesFile(ctx context.Context, in *DownloadTeamsQrCodesFileReq, opts ...grpc.CallOption) (*DownloadTeamsQrCodesFileRsp, error) { func (c *eveningDetectiveClient) DownloadTeamsQrCodesFile(ctx context.Context, in *DownloadTeamsQrCodesFileReq, opts ...grpc.CallOption) (*DownloadTeamsQrCodesFileRsp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(DownloadTeamsQrCodesFileRsp) out := new(DownloadTeamsQrCodesFileRsp)
err := c.cc.Invoke(ctx, EveningDetective_DownloadTeamsQrCodesFile_FullMethodName, in, out, opts...) err := c.cc.Invoke(ctx, EveningDetective_DownloadTeamsQrCodesFile_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *eveningDetectiveClient) GetGraph(ctx context.Context, in *GetGraphReq, opts ...grpc.CallOption) (*GetGraphRsp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetGraphRsp)
err := c.cc.Invoke(ctx, EveningDetective_GetGraph_FullMethodName, in, out, cOpts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -158,7 +181,7 @@ func (c *eveningDetectiveClient) DownloadTeamsQrCodesFile(ctx context.Context, i
// EveningDetectiveServer is the server API for EveningDetective service. // EveningDetectiveServer is the server API for EveningDetective service.
// All implementations must embed UnimplementedEveningDetectiveServer // All implementations must embed UnimplementedEveningDetectiveServer
// for forward compatibility // for forward compatibility.
type EveningDetectiveServer interface { type EveningDetectiveServer interface {
Ping(context.Context, *PingReq) (*PingRsp, error) Ping(context.Context, *PingReq) (*PingRsp, error)
AddTeams(context.Context, *AddTeamsReq) (*AddTeamsRsp, error) AddTeams(context.Context, *AddTeamsReq) (*AddTeamsRsp, error)
@ -171,12 +194,16 @@ type EveningDetectiveServer interface {
GameStop(context.Context, *GameStopReq) (*GameStopRsp, error) GameStop(context.Context, *GameStopReq) (*GameStopRsp, error)
GiveApplications(context.Context, *GiveApplicationsReq) (*GiveApplicationsRsp, error) GiveApplications(context.Context, *GiveApplicationsReq) (*GiveApplicationsRsp, error)
DownloadTeamsQrCodesFile(context.Context, *DownloadTeamsQrCodesFileReq) (*DownloadTeamsQrCodesFileRsp, error) DownloadTeamsQrCodesFile(context.Context, *DownloadTeamsQrCodesFileReq) (*DownloadTeamsQrCodesFileRsp, error)
GetGraph(context.Context, *GetGraphReq) (*GetGraphRsp, error)
mustEmbedUnimplementedEveningDetectiveServer() mustEmbedUnimplementedEveningDetectiveServer()
} }
// UnimplementedEveningDetectiveServer must be embedded to have forward compatible implementations. // UnimplementedEveningDetectiveServer must be embedded to have
type UnimplementedEveningDetectiveServer struct { // forward compatible implementations.
} //
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedEveningDetectiveServer struct{}
func (UnimplementedEveningDetectiveServer) Ping(context.Context, *PingReq) (*PingRsp, error) { func (UnimplementedEveningDetectiveServer) Ping(context.Context, *PingReq) (*PingRsp, error) {
return nil, status.Errorf(codes.Unimplemented, "method Ping not implemented") return nil, status.Errorf(codes.Unimplemented, "method Ping not implemented")
@ -211,7 +238,11 @@ func (UnimplementedEveningDetectiveServer) GiveApplications(context.Context, *Gi
func (UnimplementedEveningDetectiveServer) DownloadTeamsQrCodesFile(context.Context, *DownloadTeamsQrCodesFileReq) (*DownloadTeamsQrCodesFileRsp, error) { func (UnimplementedEveningDetectiveServer) DownloadTeamsQrCodesFile(context.Context, *DownloadTeamsQrCodesFileReq) (*DownloadTeamsQrCodesFileRsp, error) {
return nil, status.Errorf(codes.Unimplemented, "method DownloadTeamsQrCodesFile not implemented") return nil, status.Errorf(codes.Unimplemented, "method DownloadTeamsQrCodesFile not implemented")
} }
func (UnimplementedEveningDetectiveServer) GetGraph(context.Context, *GetGraphReq) (*GetGraphRsp, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetGraph not implemented")
}
func (UnimplementedEveningDetectiveServer) mustEmbedUnimplementedEveningDetectiveServer() {} func (UnimplementedEveningDetectiveServer) mustEmbedUnimplementedEveningDetectiveServer() {}
func (UnimplementedEveningDetectiveServer) testEmbeddedByValue() {}
// UnsafeEveningDetectiveServer may be embedded to opt out of forward compatibility for this service. // UnsafeEveningDetectiveServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to EveningDetectiveServer will // Use of this interface is not recommended, as added methods to EveningDetectiveServer will
@ -221,6 +252,13 @@ type UnsafeEveningDetectiveServer interface {
} }
func RegisterEveningDetectiveServer(s grpc.ServiceRegistrar, srv EveningDetectiveServer) { func RegisterEveningDetectiveServer(s grpc.ServiceRegistrar, srv EveningDetectiveServer) {
// If the following call pancis, it indicates UnimplementedEveningDetectiveServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&EveningDetective_ServiceDesc, srv) s.RegisterService(&EveningDetective_ServiceDesc, srv)
} }
@ -422,6 +460,24 @@ func _EveningDetective_DownloadTeamsQrCodesFile_Handler(srv interface{}, ctx con
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _EveningDetective_GetGraph_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetGraphReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(EveningDetectiveServer).GetGraph(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: EveningDetective_GetGraph_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(EveningDetectiveServer).GetGraph(ctx, req.(*GetGraphReq))
}
return interceptor(ctx, in, info, handler)
}
// EveningDetective_ServiceDesc is the grpc.ServiceDesc for EveningDetective service. // EveningDetective_ServiceDesc is the grpc.ServiceDesc for EveningDetective service.
// It's only intended for direct use with grpc.RegisterService, // It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy) // and not to be introspected or modified (even as a copy)
@ -473,6 +529,10 @@ var EveningDetective_ServiceDesc = grpc.ServiceDesc{
MethodName: "DownloadTeamsQrCodesFile", MethodName: "DownloadTeamsQrCodesFile",
Handler: _EveningDetective_DownloadTeamsQrCodesFile_Handler, Handler: _EveningDetective_DownloadTeamsQrCodesFile_Handler,
}, },
{
MethodName: "GetGraph",
Handler: _EveningDetective_GetGraph_Handler,
},
}, },
Streams: []grpc.StreamDesc{}, Streams: []grpc.StreamDesc{},
Metadata: "main.proto", Metadata: "main.proto",