protoc-gen-go-types

command module
v1.34.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 10, 2023 License: BSD-3-Clause Imports: 8 Imported by: 0

README

Fork of Protobuf Golang specialized for type generation

This package supposed to focus on type generation based on proto file.

Features compared to original repository

  • Flags to REMOVE protobuf specific field generation
  • Make difference between optional and non-optional in case of structs. So it's generating non-pointer in case of non-optional

Installation

go install github.com/infiniteloopcloud/protoc-gen-go-types@latest

Flags

These are actually environment variables.

  • SKIP_PROTOBUF_SPECIFIC=false - Skip protobuf specific code
  • TYPE_OVERRIDE - Enable type override

Type override

Supported overwrite:

  • TimeTime -> time.Time
  • RepeatedString -> []string
Example
syntax = "proto3";

message SomeStruct {
  TimeTime created_at = 1; // This will be time.Time
}

message TimeTime {}
Important

Currently the overwritten FieldOptions (go_type, go_import, go_import_alias, go_zero_override) must be paired with these numbers: go_type = 1001 go_import = 1002 go_import_alias = 1003 go_zero_override = 1004 go_struct_tags = 1005 Because protoc can't process the extended options, so we can't find the by name, just by place.

Documentation

Overview

The protoc-gen-go binary is a protoc plugin to generate Go code for both proto2 and proto3 versions of the protocol buffer language.

For more information about the usage of this plugin, see:

https://developers.google.com/protocol-buffers/docs/reference/go-generated

Directories

Path Synopsis
cmd
protoc-gen-go/internal_gengo
Package internal_gengo is internal to the protobuf module.
Package internal_gengo is internal to the protobuf module.
compiler
protogen
Package protogen provides support for writing protoc plugins.
Package protogen provides support for writing protoc plugins.
encoding
protodelim
Package protodelim marshals and unmarshals varint size-delimited messages.
Package protodelim marshals and unmarshals varint size-delimited messages.
protojson
Package protojson marshals and unmarshals protocol buffer messages as JSON format.
Package protojson marshals and unmarshals protocol buffer messages as JSON format.
prototext
Package prototext marshals and unmarshals protocol buffer messages as the textproto format.
Package prototext marshals and unmarshals protocol buffer messages as the textproto format.
protowire
Package protowire parses and formats the raw wire encoding.
Package protowire parses and formats the raw wire encoding.
internal
descfmt
Package descfmt provides functionality to format descriptors.
Package descfmt provides functionality to format descriptors.
descopts
Package descopts contains the nil pointers to concrete descriptor options.
Package descopts contains the nil pointers to concrete descriptor options.
detrand
Package detrand provides deterministically random functionality.
Package detrand provides deterministically random functionality.
encoding/defval
Package defval marshals and unmarshals textual forms of default values.
Package defval marshals and unmarshals textual forms of default values.
encoding/messageset
Package messageset encodes and decodes the obsolete MessageSet wire format.
Package messageset encodes and decodes the obsolete MessageSet wire format.
encoding/tag
Package tag marshals and unmarshals the legacy struct tags as generated by historical versions of protoc-gen-go.
Package tag marshals and unmarshals the legacy struct tags as generated by historical versions of protoc-gen-go.
encoding/text
Package text implements the text format for protocol buffers.
Package text implements the text format for protocol buffers.
errors
Package errors implements functions to manipulate errors.
Package errors implements functions to manipulate errors.
filedesc
Package filedesc provides functionality for constructing descriptors.
Package filedesc provides functionality for constructing descriptors.
filetype
Package filetype provides functionality for wrapping descriptors with Go type information.
Package filetype provides functionality for wrapping descriptors with Go type information.
flags
Package flags provides a set of flags controlled by build tags.
Package flags provides a set of flags controlled by build tags.
fuzz/jsonfuzz
Package jsonfuzz includes fuzzers for protojson.Marshal and protojson.Unmarshal.
Package jsonfuzz includes fuzzers for protojson.Marshal and protojson.Unmarshal.
fuzz/textfuzz
Package textfuzz includes fuzzers for prototext.Marshal and prototext.Unmarshal.
Package textfuzz includes fuzzers for prototext.Marshal and prototext.Unmarshal.
fuzz/wirefuzz
Package wirefuzz includes a fuzzer for the wire marshaler and unmarshaler.
Package wirefuzz includes a fuzzer for the wire marshaler and unmarshaler.
fuzztest
Package fuzztest contains a common fuzzer test.
Package fuzztest contains a common fuzzer test.
genid
Package genid contains constants for declarations in descriptor.proto and the well-known types.
Package genid contains constants for declarations in descriptor.proto and the well-known types.
msgfmt
Package msgfmt implements a text marshaler combining the desirable features of both the JSON and proto text formats.
Package msgfmt implements a text marshaler combining the desirable features of both the JSON and proto text formats.
order
Package order provides ordered access to messages and maps.
Package order provides ordered access to messages and maps.
pragma
Package pragma provides types that can be embedded into a struct to statically enforce or prevent certain language properties.
Package pragma provides types that can be embedded into a struct to statically enforce or prevent certain language properties.
protobuild
Package protobuild constructs messages.
Package protobuild constructs messages.
protolegacy
Package protolegacy is a stub version of the v1 proto package to satisfy internal/testprotos/legacy dependencies.
Package protolegacy is a stub version of the v1 proto package to satisfy internal/testprotos/legacy dependencies.
set
Package set provides simple set data structures for uint64s.
Package set provides simple set data structures for uint64s.
strs
Package strs provides string manipulation functionality specific to protobuf.
Package strs provides string manipulation functionality specific to protobuf.
testprotos/legacy/proto2_20160225_2fc053c5
Package proto2_20160225_2fc053c5 is a generated protocol buffer package.
Package proto2_20160225_2fc053c5 is a generated protocol buffer package.
testprotos/legacy/proto2_20160519_a4ab9ec5
Package proto2_20160519_a4ab9ec5 is a generated protocol buffer package.
Package proto2_20160519_a4ab9ec5 is a generated protocol buffer package.
testprotos/legacy/proto2_20180125_92554152
Package proto2_20180125_92554152 is a generated protocol buffer package.
Package proto2_20180125_92554152 is a generated protocol buffer package.
testprotos/legacy/proto3_20160225_2fc053c5
Package proto3_20160225_2fc053c5 is a generated protocol buffer package.
Package proto3_20160225_2fc053c5 is a generated protocol buffer package.
testprotos/legacy/proto3_20160519_a4ab9ec5
Package proto3_20160519_a4ab9ec5 is a generated protocol buffer package.
Package proto3_20160519_a4ab9ec5 is a generated protocol buffer package.
testprotos/legacy/proto3_20180125_92554152
Package proto3_20180125_92554152 is a generated protocol buffer package.
Package proto3_20180125_92554152 is a generated protocol buffer package.
version
Package version records versioning information about this module.
Package version records versioning information about this module.
weakdeps
Package weakdeps exists to add weak module dependencies.
Package weakdeps exists to add weak module dependencies.
Package proto provides functions operating on protocol buffer messages.
Package proto provides functions operating on protocol buffer messages.
reflect
protodesc
Package protodesc provides functionality for converting FileDescriptorProto messages to/from protoreflect.FileDescriptor values.
Package protodesc provides functionality for converting FileDescriptorProto messages to/from protoreflect.FileDescriptor values.
protopath
Package protopath provides functionality for representing a sequence of protobuf reflection operations on a message.
Package protopath provides functionality for representing a sequence of protobuf reflection operations on a message.
protorange
Package protorange provides functionality to traverse a message value.
Package protorange provides functionality to traverse a message value.
protoreflect
Package protoreflect provides interfaces to dynamically manipulate messages.
Package protoreflect provides interfaces to dynamically manipulate messages.
protoregistry
Package protoregistry provides data structures to register and lookup protobuf descriptor types.
Package protoregistry provides data structures to register and lookup protobuf descriptor types.
runtime
protoiface
Package protoiface contains types referenced or implemented by messages.
Package protoiface contains types referenced or implemented by messages.
protoimpl
Package protoimpl contains the default implementation for messages generated by protoc-gen-go.
Package protoimpl contains the default implementation for messages generated by protoc-gen-go.
testing
protocmp
Package protocmp provides protobuf specific options for the "github.com/google/go-cmp/cmp" package.
Package protocmp provides protobuf specific options for the "github.com/google/go-cmp/cmp" package.
protopack
Package protopack enables manual encoding and decoding of protobuf wire data.
Package protopack enables manual encoding and decoding of protobuf wire data.
prototest
Package prototest exercises protobuf reflection.
Package prototest exercises protobuf reflection.
types
dynamicpb
Package dynamicpb creates protocol buffer messages using runtime type information.
Package dynamicpb creates protocol buffer messages using runtime type information.
known/anypb
Package anypb contains generated types for google/protobuf/any.proto.
Package anypb contains generated types for google/protobuf/any.proto.
known/durationpb
Package durationpb contains generated types for google/protobuf/duration.proto.
Package durationpb contains generated types for google/protobuf/duration.proto.
known/fieldmaskpb
Package fieldmaskpb contains generated types for google/protobuf/field_mask.proto.
Package fieldmaskpb contains generated types for google/protobuf/field_mask.proto.
known/structpb
Package structpb contains generated types for google/protobuf/struct.proto.
Package structpb contains generated types for google/protobuf/struct.proto.
known/timestamppb
Package timestamppb contains generated types for google/protobuf/timestamp.proto.
Package timestamppb contains generated types for google/protobuf/timestamp.proto.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL