Ejemplo n.º 1
0
        public override RpcDefinition VisitRpc_method([NotNull] FlatBuffersParser.Rpc_methodContext context)
        {
            var    idents       = context.IDENT();
            string name         = idents[0].GetText();
            string requestType  = idents[1].GetText();
            string responseType = idents[2].GetText();
            Dictionary <string, string> metadata = new MetadataVisitor().Visit(context.metadata());

            var streamingType = RpcStreamingType.Unary;

            if (metadata.TryGetValue("streaming", out string value))
            {
                streamingType = ParseStreamingType(value);
            }

            this.rpcDefinition.AddRpcMethod(name, requestType, responseType, streamingType);
            return(null);
        }
Ejemplo n.º 2
0
        public override RpcDefinition?VisitRpc_method([NotNull] FlatBuffersParser.Rpc_methodContext context)
        {
            var definition = this.rpcDefinition ?? throw new InvalidOperationException($"FlatSharp.Internal: Failed to initialize RPC definition");

            var    idents       = context.IDENT();
            string name         = idents[0].GetText();
            string requestType  = idents[1].GetText();
            string responseType = idents[2].GetText();
            Dictionary <string, string?> metadata = new MetadataVisitor().Visit(context.metadata());

            var streamingType = RpcStreamingType.Unary;

            if (metadata.TryGetValue("streaming", out string?value))
            {
                streamingType = ParseStreamingType(value);
            }

            definition.AddRpcMethod(name, requestType, responseType, streamingType);
            return(null);
        }