rename postgres container

This commit is contained in:
2026-06-29 00:39:01 +07:00
parent 36575fd0fc
commit 3ec2853df6
5 changed files with 754 additions and 2 deletions
@@ -0,0 +1,113 @@
{
"swagger": "2.0",
"info": {
"title": "main.proto",
"version": "version not set"
},
"tags": [
{
"name": "EveningDetectiveServer"
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {
"/api/echo": {
"post": {
"operationId": "EveningDetectiveServer_Echo",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/evening_detective_serverEchoRsp"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"parameters": [
{
"name": "text",
"in": "query",
"required": false,
"type": "string"
}
],
"tags": [
"EveningDetectiveServer"
]
}
},
"/api/ping": {
"get": {
"operationId": "EveningDetectiveServer_Ping",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/evening_detective_serverPingRsp"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"tags": [
"EveningDetectiveServer"
]
}
}
},
"definitions": {
"evening_detective_serverEchoRsp": {
"type": "object",
"properties": {
"text": {
"type": "string"
}
}
},
"evening_detective_serverPingRsp": {
"type": "object"
},
"protobufAny": {
"type": "object",
"properties": {
"@type": {
"type": "string"
}
},
"additionalProperties": {}
},
"rpcStatus": {
"type": "object",
"properties": {
"code": {
"type": "integer",
"format": "int32"
},
"message": {
"type": "string"
},
"details": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/protobufAny"
}
}
}
}
}
}
+2 -2
View File
@@ -1,9 +1,9 @@
version: '3.8'
services:
postgres:
postgres_evening_detective_server:
image: postgres:15
container_name: postgres15
container_name: postgres_evening_detective_server
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
+254
View File
@@ -0,0 +1,254 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.11
// protoc v7.35.0
// source: main.proto
package proto
import (
_ "google.golang.org/genproto/googleapis/api/annotations"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
unsafe "unsafe"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type PingReq struct {
state protoimpl.MessageState `protogen:"open.v1"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *PingReq) Reset() {
*x = PingReq{}
mi := &file_main_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *PingReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*PingReq) ProtoMessage() {}
func (x *PingReq) ProtoReflect() protoreflect.Message {
mi := &file_main_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use PingReq.ProtoReflect.Descriptor instead.
func (*PingReq) Descriptor() ([]byte, []int) {
return file_main_proto_rawDescGZIP(), []int{0}
}
type PingRsp struct {
state protoimpl.MessageState `protogen:"open.v1"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *PingRsp) Reset() {
*x = PingRsp{}
mi := &file_main_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *PingRsp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*PingRsp) ProtoMessage() {}
func (x *PingRsp) ProtoReflect() protoreflect.Message {
mi := &file_main_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use PingRsp.ProtoReflect.Descriptor instead.
func (*PingRsp) Descriptor() ([]byte, []int) {
return file_main_proto_rawDescGZIP(), []int{1}
}
type EchoReq struct {
state protoimpl.MessageState `protogen:"open.v1"`
Text string `protobuf:"bytes,1,opt,name=text,proto3" json:"text,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *EchoReq) Reset() {
*x = EchoReq{}
mi := &file_main_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *EchoReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*EchoReq) ProtoMessage() {}
func (x *EchoReq) ProtoReflect() protoreflect.Message {
mi := &file_main_proto_msgTypes[2]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use EchoReq.ProtoReflect.Descriptor instead.
func (*EchoReq) Descriptor() ([]byte, []int) {
return file_main_proto_rawDescGZIP(), []int{2}
}
func (x *EchoReq) GetText() string {
if x != nil {
return x.Text
}
return ""
}
type EchoRsp struct {
state protoimpl.MessageState `protogen:"open.v1"`
Text string `protobuf:"bytes,1,opt,name=text,proto3" json:"text,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *EchoRsp) Reset() {
*x = EchoRsp{}
mi := &file_main_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *EchoRsp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*EchoRsp) ProtoMessage() {}
func (x *EchoRsp) ProtoReflect() protoreflect.Message {
mi := &file_main_proto_msgTypes[3]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use EchoRsp.ProtoReflect.Descriptor instead.
func (*EchoRsp) Descriptor() ([]byte, []int) {
return file_main_proto_rawDescGZIP(), []int{3}
}
func (x *EchoRsp) GetText() string {
if x != nil {
return x.Text
}
return ""
}
var File_main_proto protoreflect.FileDescriptor
const file_main_proto_rawDesc = "" +
"\n" +
"\n" +
"main.proto\x12\x1ecrabs.evening_detective_server\x1a\x1cgoogle/api/annotations.proto\"\t\n" +
"\aPingReq\"\t\n" +
"\aPingRsp\"\x1d\n" +
"\aEchoReq\x12\x12\n" +
"\x04text\x18\x01 \x01(\tR\x04text\"\x1d\n" +
"\aEchoRsp\x12\x12\n" +
"\x04text\x18\x01 \x01(\tR\x04text2\xf2\x01\n" +
"\x16EveningDetectiveServer\x12k\n" +
"\x04Ping\x12'.crabs.evening_detective_server.PingReq\x1a'.crabs.evening_detective_server.PingRsp\"\x11\x82\xd3\xe4\x93\x02\v\x12\t/api/ping\x12k\n" +
"\x04Echo\x12'.crabs.evening_detective_server.EchoReq\x1a'.crabs.evening_detective_server.EchoRsp\"\x11\x82\xd3\xe4\x93\x02\v\"\t/api/echoB\vZ\tpkg/protob\x06proto3"
var (
file_main_proto_rawDescOnce sync.Once
file_main_proto_rawDescData []byte
)
func file_main_proto_rawDescGZIP() []byte {
file_main_proto_rawDescOnce.Do(func() {
file_main_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_main_proto_rawDesc), len(file_main_proto_rawDesc)))
})
return file_main_proto_rawDescData
}
var file_main_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_main_proto_goTypes = []any{
(*PingReq)(nil), // 0: crabs.evening_detective_server.PingReq
(*PingRsp)(nil), // 1: crabs.evening_detective_server.PingRsp
(*EchoReq)(nil), // 2: crabs.evening_detective_server.EchoReq
(*EchoRsp)(nil), // 3: crabs.evening_detective_server.EchoRsp
}
var file_main_proto_depIdxs = []int32{
0, // 0: crabs.evening_detective_server.EveningDetectiveServer.Ping:input_type -> crabs.evening_detective_server.PingReq
2, // 1: crabs.evening_detective_server.EveningDetectiveServer.Echo:input_type -> crabs.evening_detective_server.EchoReq
1, // 2: crabs.evening_detective_server.EveningDetectiveServer.Ping:output_type -> crabs.evening_detective_server.PingRsp
3, // 3: crabs.evening_detective_server.EveningDetectiveServer.Echo:output_type -> crabs.evening_detective_server.EchoRsp
2, // [2:4] is the sub-list for method output_type
0, // [0:2] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_main_proto_init() }
func file_main_proto_init() {
if File_main_proto != nil {
return
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_main_proto_rawDesc), len(file_main_proto_rawDesc)),
NumEnums: 0,
NumMessages: 4,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_main_proto_goTypes,
DependencyIndexes: file_main_proto_depIdxs,
MessageInfos: file_main_proto_msgTypes,
}.Build()
File_main_proto = out.File
file_main_proto_goTypes = nil
file_main_proto_depIdxs = nil
}
+225
View File
@@ -0,0 +1,225 @@
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
// source: main.proto
/*
Package proto is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
*/
package proto
import (
"context"
"errors"
"io"
"net/http"
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
"github.com/grpc-ecosystem/grpc-gateway/v2/utilities"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/grpclog"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/proto"
)
// Suppress "imported and not used" errors
var (
_ codes.Code
_ io.Reader
_ status.Status
_ = errors.New
_ = runtime.String
_ = utilities.NewDoubleArray
_ = metadata.Join
)
func request_EveningDetectiveServer_Ping_0(ctx context.Context, marshaler runtime.Marshaler, client EveningDetectiveServerClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq PingReq
metadata runtime.ServerMetadata
)
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
msg, err := client.Ping(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_EveningDetectiveServer_Ping_0(ctx context.Context, marshaler runtime.Marshaler, server EveningDetectiveServerServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq PingReq
metadata runtime.ServerMetadata
)
msg, err := server.Ping(ctx, &protoReq)
return msg, metadata, err
}
var filter_EveningDetectiveServer_Echo_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
func request_EveningDetectiveServer_Echo_0(ctx context.Context, marshaler runtime.Marshaler, client EveningDetectiveServerClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq EchoReq
metadata runtime.ServerMetadata
)
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_EveningDetectiveServer_Echo_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.Echo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_EveningDetectiveServer_Echo_0(ctx context.Context, marshaler runtime.Marshaler, server EveningDetectiveServerServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq EchoReq
metadata runtime.ServerMetadata
)
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_EveningDetectiveServer_Echo_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.Echo(ctx, &protoReq)
return msg, metadata, err
}
// RegisterEveningDetectiveServerHandlerServer registers the http handlers for service EveningDetectiveServer to "mux".
// UnaryRPC :call EveningDetectiveServerServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterEveningDetectiveServerHandlerFromEndpoint instead.
// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.
func RegisterEveningDetectiveServerHandlerServer(ctx context.Context, mux *runtime.ServeMux, server EveningDetectiveServerServer) error {
mux.Handle(http.MethodGet, pattern_EveningDetectiveServer_Ping_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/crabs.evening_detective_server.EveningDetectiveServer/Ping", runtime.WithHTTPPathPattern("/api/ping"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_EveningDetectiveServer_Ping_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_EveningDetectiveServer_Ping_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_EveningDetectiveServer_Echo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/crabs.evening_detective_server.EveningDetectiveServer/Echo", runtime.WithHTTPPathPattern("/api/echo"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_EveningDetectiveServer_Echo_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_EveningDetectiveServer_Echo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
// RegisterEveningDetectiveServerHandlerFromEndpoint is same as RegisterEveningDetectiveServerHandler but
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterEveningDetectiveServerHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
conn, err := grpc.NewClient(endpoint, opts...)
if err != nil {
return err
}
defer func() {
if err != nil {
if cerr := conn.Close(); cerr != nil {
grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
}
return
}
go func() {
<-ctx.Done()
if cerr := conn.Close(); cerr != nil {
grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
}
}()
}()
return RegisterEveningDetectiveServerHandler(ctx, mux, conn)
}
// RegisterEveningDetectiveServerHandler registers the http handlers for service EveningDetectiveServer to "mux".
// The handlers forward requests to the grpc endpoint over "conn".
func RegisterEveningDetectiveServerHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterEveningDetectiveServerHandlerClient(ctx, mux, NewEveningDetectiveServerClient(conn))
}
// RegisterEveningDetectiveServerHandlerClient registers the http handlers for service EveningDetectiveServer
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "EveningDetectiveServerClient".
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "EveningDetectiveServerClient"
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
// "EveningDetectiveServerClient" to call the correct interceptors. This client ignores the HTTP middlewares.
func RegisterEveningDetectiveServerHandlerClient(ctx context.Context, mux *runtime.ServeMux, client EveningDetectiveServerClient) error {
mux.Handle(http.MethodGet, pattern_EveningDetectiveServer_Ping_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/crabs.evening_detective_server.EveningDetectiveServer/Ping", runtime.WithHTTPPathPattern("/api/ping"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_EveningDetectiveServer_Ping_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_EveningDetectiveServer_Ping_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_EveningDetectiveServer_Echo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/crabs.evening_detective_server.EveningDetectiveServer/Echo", runtime.WithHTTPPathPattern("/api/echo"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_EveningDetectiveServer_Echo_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_EveningDetectiveServer_Echo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
var (
pattern_EveningDetectiveServer_Ping_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"api", "ping"}, ""))
pattern_EveningDetectiveServer_Echo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"api", "echo"}, ""))
)
var (
forward_EveningDetectiveServer_Ping_0 = runtime.ForwardResponseMessage
forward_EveningDetectiveServer_Echo_0 = runtime.ForwardResponseMessage
)
+160
View File
@@ -0,0 +1,160 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.2
// - protoc v7.35.0
// source: main.proto
package proto
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
EveningDetectiveServer_Ping_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/Ping"
EveningDetectiveServer_Echo_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/Echo"
)
// EveningDetectiveServerClient is the client API for EveningDetectiveServer service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type EveningDetectiveServerClient interface {
Ping(ctx context.Context, in *PingReq, opts ...grpc.CallOption) (*PingRsp, error)
Echo(ctx context.Context, in *EchoReq, opts ...grpc.CallOption) (*EchoRsp, error)
}
type eveningDetectiveServerClient struct {
cc grpc.ClientConnInterface
}
func NewEveningDetectiveServerClient(cc grpc.ClientConnInterface) EveningDetectiveServerClient {
return &eveningDetectiveServerClient{cc}
}
func (c *eveningDetectiveServerClient) Ping(ctx context.Context, in *PingReq, opts ...grpc.CallOption) (*PingRsp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(PingRsp)
err := c.cc.Invoke(ctx, EveningDetectiveServer_Ping_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *eveningDetectiveServerClient) Echo(ctx context.Context, in *EchoReq, opts ...grpc.CallOption) (*EchoRsp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(EchoRsp)
err := c.cc.Invoke(ctx, EveningDetectiveServer_Echo_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// EveningDetectiveServerServer is the server API for EveningDetectiveServer service.
// All implementations must embed UnimplementedEveningDetectiveServerServer
// for forward compatibility.
type EveningDetectiveServerServer interface {
Ping(context.Context, *PingReq) (*PingRsp, error)
Echo(context.Context, *EchoReq) (*EchoRsp, error)
mustEmbedUnimplementedEveningDetectiveServerServer()
}
// UnimplementedEveningDetectiveServerServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedEveningDetectiveServerServer struct{}
func (UnimplementedEveningDetectiveServerServer) Ping(context.Context, *PingReq) (*PingRsp, error) {
return nil, status.Error(codes.Unimplemented, "method Ping not implemented")
}
func (UnimplementedEveningDetectiveServerServer) Echo(context.Context, *EchoReq) (*EchoRsp, error) {
return nil, status.Error(codes.Unimplemented, "method Echo not implemented")
}
func (UnimplementedEveningDetectiveServerServer) mustEmbedUnimplementedEveningDetectiveServerServer() {
}
func (UnimplementedEveningDetectiveServerServer) testEmbeddedByValue() {}
// UnsafeEveningDetectiveServerServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to EveningDetectiveServerServer will
// result in compilation errors.
type UnsafeEveningDetectiveServerServer interface {
mustEmbedUnimplementedEveningDetectiveServerServer()
}
func RegisterEveningDetectiveServerServer(s grpc.ServiceRegistrar, srv EveningDetectiveServerServer) {
// If the following call panics, it indicates UnimplementedEveningDetectiveServerServer 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(&EveningDetectiveServer_ServiceDesc, srv)
}
func _EveningDetectiveServer_Ping_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(PingReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(EveningDetectiveServerServer).Ping(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: EveningDetectiveServer_Ping_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(EveningDetectiveServerServer).Ping(ctx, req.(*PingReq))
}
return interceptor(ctx, in, info, handler)
}
func _EveningDetectiveServer_Echo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(EchoReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(EveningDetectiveServerServer).Echo(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: EveningDetectiveServer_Echo_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(EveningDetectiveServerServer).Echo(ctx, req.(*EchoReq))
}
return interceptor(ctx, in, info, handler)
}
// EveningDetectiveServer_ServiceDesc is the grpc.ServiceDesc for EveningDetectiveServer service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var EveningDetectiveServer_ServiceDesc = grpc.ServiceDesc{
ServiceName: "crabs.evening_detective_server.EveningDetectiveServer",
HandlerType: (*EveningDetectiveServerServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Ping",
Handler: _EveningDetectiveServer_Ping_Handler,
},
{
MethodName: "Echo",
Handler: _EveningDetectiveServer_Echo_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "main.proto",
}