Skip to content

Guide

This guide covers the core concepts of vgi-rpc-go — from struct tags and streaming to HTTP transport and error handling.

Topics

  • Struct Tags — map Go struct fields to Arrow columns with options for defaults, enums, and type overrides
  • Streaming — producer and exchange patterns, OutputCollector, StreamResult, and stream headers
  • ArrowSerializable — implement custom Arrow schemas for complex types
  • HTTP Transport — serve RPC over HTTP with signed state tokens
  • Error Handling — RpcError, ErrRpc sentinel, and standard error types
  • Introspection — the __describe__ endpoint for service discovery

Quick Overview

Registration

vgirpc.Unary[P, R](server, name, handler)
vgirpc.UnaryVoid[P](server, name, handler)
vgirpc.Producer[P](server, name, outputSchema, handler)
vgirpc.ProducerWithHeader[P](server, name, outputSchema, headerSchema, handler)
vgirpc.Exchange[P](server, name, outputSchema, inputSchema, handler)
vgirpc.ExchangeWithHeader[P](server, name, outputSchema, inputSchema, headerSchema, handler)

Transports

server.RunStdio()                          // stdin/stdout
server.Serve(reader, writer)               // any io.Reader/Writer
server.ServeWithContext(ctx, reader, writer) // with context

httpServer := vgirpc.NewHttpServer(server) // HTTP
http.ListenAndServe(":8080", httpServer)