{"modulePath":"github.com/eric-erki/https-hyperledger.org","version":"v1.4.4","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package protolator\n\n## Functions\n\n```go\nfunc DeepMarshalJSON(w io.Writer, msg proto.Message) error\n```\nDeepMarshalJSON marshals msg to w as JSON, but instead of marshaling bytes fields which contain nested marshaled messages as base64 (like the standard proto encoding), these nested messages are remarshaled as the JSON representation of those messages.  This is done so that the JSON representation is as non-binary and human readable as possible.\n\n```go\nfunc DeepUnmarshalJSON(r io.Reader, msg proto.Message) error\n```\nDeepUnmarshalJSON takes JSON output as generated by DeepMarshalJSON and decodes it into msg This includes re-marshaling the expanded nested elements to binary form\n\n```go\nfunc MostlyDeterministicMarshal(msg proto.Message) ([]byte, error)\n```\nMostlyDeterministicMarshal is \\_NOT\\_ the function you are looking for. It causes protobuf serialization consistent within a single build.  It does not guarantee that the serialization is deterministic across proto versions or proto implementations.  It is useful for situations where the same process wants to compare binary messages for equality without needing to unmarshal first, but should not be used generally.\n\n## Types\n\n```go\ntype DecoratedProto interface {\n\t// Underlying returns the underlying proto message which is being dynamically decorated\n\tUnderlying() proto.Message\n}\n```\nDecoreatedProto should be implemented by the dynamic wrappers applied by the Dynamic\\*FieldProto interfaces This is necessary for the proto system to unmarshal, because it discovers proto message type by reflection (Rather than by interface definition as it probably should ( [https://github.com/golang/protobuf/issues/291](https://github.com/golang/protobuf/issues/291) )\n\n```go\ntype DynamicFieldProto interface {\n\t// DynamicFields returns the field names which are dynamic\n\tDynamicFields() []string\n\n\t// DynamicFieldProto returns a newly allocated dynamic message, decorating an underlying\n\t// proto message with the runtime determined function\n\tDynamicFieldProto(name string, underlying proto.Message) (proto.Message, error)\n}\n```\nDynamicFieldProto should be implemented by protos which have nested fields whose attributes (such as their opaque types) cannot be determined until runtime\n\n```go\ntype DynamicMapFieldProto interface {\n\t// DynamicFields returns the field names which are dynamic\n\tDynamicMapFields() []string\n\n\t// DynamicMapFieldProto returns a newly allocated dynamic message, decorating an underlying\n\t// proto message with the runtime determined function\n\tDynamicMapFieldProto(name string, key string, underlying proto.Message) (proto.Message, error)\n}\n```\nDynamicMapFieldProto should be implemented by protos which have maps to messages whose attributes (such as their opaque types) cannot be determined until runtime\n\n```go\ntype DynamicSliceFieldProto interface {\n\t// DynamicFields returns the field names which are dynamic\n\tDynamicSliceFields() []string\n\n\t// DynamicSliceFieldProto returns a newly allocated dynamic message, decorating an underlying\n\t// proto message with the runtime determined function\n\tDynamicSliceFieldProto(name string, index int, underlying proto.Message) (proto.Message, error)\n}\n```\nDynamicSliceFieldProto should be implemented by protos which have slices of messages whose attributes (such as their opaque types) cannot be determined until runtime\n\n```go\ntype StaticallyOpaqueFieldProto interface {\n\t// StaticallyOpaqueFields returns the field names which contain opaque data\n\tStaticallyOpaqueFields() []string\n\n\t// StaticallyOpaqueFieldProto returns a newly allocated proto message of the correct\n\t// type for the field name.\n\tStaticallyOpaqueFieldProto(name string) (proto.Message, error)\n}\n```\nStaticallyOpaqueFieldProto should be implemented by protos which have bytes fields which are the marshaled value of a fixed type\n\n```go\ntype StaticallyOpaqueMapFieldProto interface {\n\t// StaticallyOpaqueFields returns the field names which contain opaque data\n\tStaticallyOpaqueMapFields() []string\n\n\t// StaticallyOpaqueFieldProto returns a newly allocated proto message of the correct\n\t// type for the field name.\n\tStaticallyOpaqueMapFieldProto(name string, key string) (proto.Message, error)\n}\n```\nStaticallyOpaqueMapFieldProto should be implemented by protos which have maps to bytes fields which are the marshaled value of a fixed type\n\n```go\ntype StaticallyOpaqueSliceFieldProto interface {\n\t// StaticallyOpaqueFields returns the field names which contain opaque data\n\tStaticallyOpaqueSliceFields() []string\n\n\t// StaticallyOpaqueFieldProto returns a newly allocated proto message of the correct\n\t// type for the field name.\n\tStaticallyOpaqueSliceFieldProto(name string, index int) (proto.Message, error)\n}\n```\nStaticallyOpaqueSliceFieldProto should be implemented by protos which have maps to bytes fields which are the marshaled value of a fixed type\n\n```go\ntype VariablyOpaqueFieldProto interface {\n\t// VariablyOpaqueFields returns the field names which contain opaque data\n\tVariablyOpaqueFields() []string\n\n\t// VariablyOpaqueFieldProto returns a newly allocated proto message of the correct\n\t// type for the field name.\n\tVariablyOpaqueFieldProto(name string) (proto.Message, error)\n}\n```\nVariablyOpaqueFieldProto should be implemented by protos which have bytes fields which are the marshaled value depends upon the other contents of the proto\n\n```go\ntype VariablyOpaqueMapFieldProto interface {\n\t// VariablyOpaqueFields returns the field names which contain opaque data\n\tVariablyOpaqueMapFields() []string\n\n\t// VariablyOpaqueFieldProto returns a newly allocated proto message of the correct\n\t// type for the field name.\n\tVariablyOpaqueMapFieldProto(name string, key string) (proto.Message, error)\n}\n```\nVariablyOpaqueMapFieldProto should be implemented by protos which have maps to bytes fields which are the marshaled value of a a message type determined by the other contents of the proto\n\n```go\ntype VariablyOpaqueSliceFieldProto interface {\n\t// VariablyOpaqueFields returns the field names which contain opaque data\n\tVariablyOpaqueSliceFields() []string\n\n\t// VariablyOpaqueFieldProto returns a newly allocated proto message of the correct\n\t// type for the field name.\n\tVariablyOpaqueSliceFieldProto(name string, index int) (proto.Message, error)\n}\n```\nVariablyOpaqueSliceFieldProto should be implemented by protos which have maps to bytes fields which are the marshaled value of a a message type determined by the other contents of the proto\n\n","path":"github.com/eric-erki/https-hyperledger.org/common/tools/protolator","name":"protolator","synopsis":"","isRedistributable":true}
