connectproto
allows Connect users to customize the default JSON
and binary codecs. It also includes support for the optimized marshaling
methods generated by vtprotobuf.
go get go.akshayshah.org/connectproto
Use this package's options just like the ones built into connect-go
:
opt := connectproto.WithJSON(
protojson.MarshalOptions{UseProtoNames: true},
protojson.UnmarshalOptions{DiscardUnknown: true},
)
// The pingv1connect package is generated from your Protocol Buffer schemas
// by protoc-gen-connect-go. You can use connectproto options with
// both handlers and clients.
route, handler := pingv1connect.NewPingServiceHandler(
&pingv1connect.UnimplementedPingServiceHandler{},
opt,
)
client := pingv1connect.NewPingServiceClient(
http.DefaultClient,
"https://localhost:8080",
opt,
)
This module is unstable, with a stable release expected before the end of 2023. It supports:
- The two most recent major releases of Go.
- APIv2 of Protocol Buffers in Go (
google.golang.org/protobuf
).
Within those parameters, connectproto
follows semantic versioning.
Offered under the MIT license.