Documentation
¶
Index ¶
- type ExamplepbDynamicMessage
- func (m *ExamplepbDynamicMessage) ContextValidate(ctx context.Context, formats strfmt.Registry) error
- func (m *ExamplepbDynamicMessage) MarshalBinary() ([]byte, error)
- func (m *ExamplepbDynamicMessage) UnmarshalBinary(b []byte) error
- func (m *ExamplepbDynamicMessage) Validate(formats strfmt.Registry) error
- type ExamplepbDynamicMessageUpdate
- func (m *ExamplepbDynamicMessageUpdate) ContextValidate(ctx context.Context, formats strfmt.Registry) error
- func (m *ExamplepbDynamicMessageUpdate) MarshalBinary() ([]byte, error)
- func (m *ExamplepbDynamicMessageUpdate) UnmarshalBinary(b []byte) error
- func (m *ExamplepbDynamicMessageUpdate) Validate(formats strfmt.Registry) error
- type ExamplepbEmbedded
- type ExamplepbNestedMessage
- func (m *ExamplepbNestedMessage) ContextValidate(ctx context.Context, formats strfmt.Registry) error
- func (m *ExamplepbNestedMessage) MarshalBinary() ([]byte, error)
- func (m *ExamplepbNestedMessage) UnmarshalBinary(b []byte) error
- func (m *ExamplepbNestedMessage) Validate(formats strfmt.Registry) error
- type ExamplepbSimpleMessage
- func (m *ExamplepbSimpleMessage) ContextValidate(ctx context.Context, formats strfmt.Registry) error
- func (m *ExamplepbSimpleMessage) MarshalBinary() ([]byte, error)
- func (m *ExamplepbSimpleMessage) UnmarshalBinary(b []byte) error
- func (m *ExamplepbSimpleMessage) Validate(formats strfmt.Registry) error
- type ExamplepbStatusCheckRequest
- func (m *ExamplepbStatusCheckRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error
- func (m *ExamplepbStatusCheckRequest) MarshalBinary() ([]byte, error)
- func (m *ExamplepbStatusCheckRequest) UnmarshalBinary(b []byte) error
- func (m *ExamplepbStatusCheckRequest) Validate(formats strfmt.Registry) error
- type ExamplepbStatusCheckResponse
- func (m *ExamplepbStatusCheckResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error
- func (m *ExamplepbStatusCheckResponse) MarshalBinary() ([]byte, error)
- func (m *ExamplepbStatusCheckResponse) UnmarshalBinary(b []byte) error
- func (m *ExamplepbStatusCheckResponse) Validate(formats strfmt.Registry) error
- type GoogleRPCStatus
- type ProtoSub2Status
- type ProtoSubStatus
- type ProtobufAny
- func (m *ProtobufAny) ContextValidate(ctx context.Context, formats strfmt.Registry) error
- func (m *ProtobufAny) MarshalBinary() ([]byte, error)
- func (m ProtobufAny) MarshalJSON() ([]byte, error)
- func (m *ProtobufAny) UnmarshalBinary(b []byte) error
- func (m *ProtobufAny) UnmarshalJSON(data []byte) error
- func (m *ProtobufAny) Validate(formats strfmt.Registry) error
- type ProtobufNullValue
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExamplepbDynamicMessage ¶
type ExamplepbDynamicMessage struct {
// struct field
StructField any `json:"structField,omitempty"`
// value field
ValueField any `json:"valueField,omitempty"`
}
ExamplepbDynamicMessage DynamicMessage represents a message which can have its structure built dynamically using Struct and Values.
swagger:model examplepbDynamicMessage
func (*ExamplepbDynamicMessage) ContextValidate ¶
func (m *ExamplepbDynamicMessage) ContextValidate(ctx context.Context, formats strfmt.Registry) error
ContextValidate validates this examplepb dynamic message based on context it is used
func (*ExamplepbDynamicMessage) MarshalBinary ¶
func (m *ExamplepbDynamicMessage) MarshalBinary() ([]byte, error)
MarshalBinary interface implementation
func (*ExamplepbDynamicMessage) UnmarshalBinary ¶
func (m *ExamplepbDynamicMessage) UnmarshalBinary(b []byte) error
UnmarshalBinary interface implementation
type ExamplepbDynamicMessageUpdate ¶
type ExamplepbDynamicMessageUpdate struct {
// body
Body *ExamplepbDynamicMessage `json:"body,omitempty"`
// update mask
UpdateMask string `json:"updateMask,omitempty"`
}
ExamplepbDynamicMessageUpdate examplepb dynamic message update
swagger:model examplepbDynamicMessageUpdate
func (*ExamplepbDynamicMessageUpdate) ContextValidate ¶
func (m *ExamplepbDynamicMessageUpdate) ContextValidate(ctx context.Context, formats strfmt.Registry) error
ContextValidate validate this examplepb dynamic message update based on the context it is used
func (*ExamplepbDynamicMessageUpdate) MarshalBinary ¶
func (m *ExamplepbDynamicMessageUpdate) MarshalBinary() ([]byte, error)
MarshalBinary interface implementation
func (*ExamplepbDynamicMessageUpdate) UnmarshalBinary ¶
func (m *ExamplepbDynamicMessageUpdate) UnmarshalBinary(b []byte) error
UnmarshalBinary interface implementation
type ExamplepbEmbedded ¶
type ExamplepbEmbedded struct {
// note
Note string `json:"note,omitempty"`
// progress
Progress string `json:"progress,omitempty"`
}
ExamplepbEmbedded Embedded represents a message embedded in SimpleMessage.
swagger:model examplepbEmbedded
func (*ExamplepbEmbedded) ContextValidate ¶
ContextValidate validates this examplepb embedded based on context it is used
func (*ExamplepbEmbedded) MarshalBinary ¶
func (m *ExamplepbEmbedded) MarshalBinary() ([]byte, error)
MarshalBinary interface implementation
func (*ExamplepbEmbedded) UnmarshalBinary ¶
func (m *ExamplepbEmbedded) UnmarshalBinary(b []byte) error
UnmarshalBinary interface implementation
type ExamplepbNestedMessage ¶
type ExamplepbNestedMessage struct {
// n Id
NID string `json:"nId,omitempty"`
// val
Val string `json:"val,omitempty"`
}
ExamplepbNestedMessage examplepb nested message
swagger:model examplepbNestedMessage
func (*ExamplepbNestedMessage) ContextValidate ¶
func (m *ExamplepbNestedMessage) ContextValidate(ctx context.Context, formats strfmt.Registry) error
ContextValidate validates this examplepb nested message based on context it is used
func (*ExamplepbNestedMessage) MarshalBinary ¶
func (m *ExamplepbNestedMessage) MarshalBinary() ([]byte, error)
MarshalBinary interface implementation
func (*ExamplepbNestedMessage) UnmarshalBinary ¶
func (m *ExamplepbNestedMessage) UnmarshalBinary(b []byte) error
UnmarshalBinary interface implementation
type ExamplepbSimpleMessage ¶
type ExamplepbSimpleMessage struct {
// en
En string `json:"en,omitempty"`
// Id represents the message identifier.
ID string `json:"id,omitempty"`
// lang
Lang string `json:"lang,omitempty"`
// line num
LineNum string `json:"lineNum,omitempty"`
// n Id
NID *ExamplepbNestedMessage `json:"nId,omitempty"`
// no
No *ExamplepbEmbedded `json:"no,omitempty"`
// num
Num string `json:"num,omitempty"`
// resource Id
ResourceID string `json:"resourceId,omitempty"`
// status
Status *ExamplepbEmbedded `json:"status,omitempty"`
}
ExamplepbSimpleMessage SimpleMessage represents a simple message sent to the Echo service.
swagger:model examplepbSimpleMessage
func (*ExamplepbSimpleMessage) ContextValidate ¶
func (m *ExamplepbSimpleMessage) ContextValidate(ctx context.Context, formats strfmt.Registry) error
ContextValidate validate this examplepb simple message based on the context it is used
func (*ExamplepbSimpleMessage) MarshalBinary ¶
func (m *ExamplepbSimpleMessage) MarshalBinary() ([]byte, error)
MarshalBinary interface implementation
func (*ExamplepbSimpleMessage) UnmarshalBinary ¶
func (m *ExamplepbSimpleMessage) UnmarshalBinary(b []byte) error
UnmarshalBinary interface implementation
type ExamplepbStatusCheckRequest ¶
type ExamplepbStatusCheckRequest struct {
// id
ID string `json:"id,omitempty"`
// Status from sub2 package (different type with same name)
Sub2Status *ProtoSub2Status `json:"sub2Status,omitempty"`
// Status from sub package
SubStatus *ProtoSubStatus `json:"subStatus,omitempty"`
}
ExamplepbStatusCheckRequest StatusCheckRequest demonstrates name collision handling. It uses Status message from both sub and sub2 packages.
swagger:model examplepbStatusCheckRequest
func (*ExamplepbStatusCheckRequest) ContextValidate ¶
func (m *ExamplepbStatusCheckRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error
ContextValidate validate this examplepb status check request based on the context it is used
func (*ExamplepbStatusCheckRequest) MarshalBinary ¶
func (m *ExamplepbStatusCheckRequest) MarshalBinary() ([]byte, error)
MarshalBinary interface implementation
func (*ExamplepbStatusCheckRequest) UnmarshalBinary ¶
func (m *ExamplepbStatusCheckRequest) UnmarshalBinary(b []byte) error
UnmarshalBinary interface implementation
type ExamplepbStatusCheckResponse ¶
type ExamplepbStatusCheckResponse struct {
// result
Result string `json:"result,omitempty"`
// sub2 status
Sub2Status *ProtoSub2Status `json:"sub2Status,omitempty"`
// Both Status types used in response
SubStatus *ProtoSubStatus `json:"subStatus,omitempty"`
}
ExamplepbStatusCheckResponse examplepb status check response
swagger:model examplepbStatusCheckResponse
func (*ExamplepbStatusCheckResponse) ContextValidate ¶
func (m *ExamplepbStatusCheckResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error
ContextValidate validate this examplepb status check response based on the context it is used
func (*ExamplepbStatusCheckResponse) MarshalBinary ¶
func (m *ExamplepbStatusCheckResponse) MarshalBinary() ([]byte, error)
MarshalBinary interface implementation
func (*ExamplepbStatusCheckResponse) UnmarshalBinary ¶
func (m *ExamplepbStatusCheckResponse) UnmarshalBinary(b []byte) error
UnmarshalBinary interface implementation
type GoogleRPCStatus ¶
type GoogleRPCStatus struct {
// The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code].
Code int32 `json:"code,omitempty"`
// A list of messages that carry the error details. There is a common set of
// message types for APIs to use.
Details []*ProtobufAny `json:"details"`
// A developer-facing error message, which should be in English. Any
// user-facing error message should be localized and sent in the
// [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client.
Message string `json:"message,omitempty"`
}
GoogleRPCStatus The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details.
You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).
swagger:model googleRpcStatus
func (*GoogleRPCStatus) ContextValidate ¶
ContextValidate validate this google Rpc status based on the context it is used
func (*GoogleRPCStatus) MarshalBinary ¶
func (m *GoogleRPCStatus) MarshalBinary() ([]byte, error)
MarshalBinary interface implementation
func (*GoogleRPCStatus) UnmarshalBinary ¶
func (m *GoogleRPCStatus) UnmarshalBinary(b []byte) error
UnmarshalBinary interface implementation
type ProtoSub2Status ¶
type ProtoSub2Status struct {
// error code
ErrorCode string `json:"errorCode,omitempty"`
// error message
ErrorMessage string `json:"errorMessage,omitempty"`
// severity
Severity int32 `json:"severity,omitempty"`
}
ProtoSub2Status Status message in sub2 package (different structure from sub.Status)
swagger:model protoSub2Status
func (*ProtoSub2Status) ContextValidate ¶
ContextValidate validates this proto sub2 status based on context it is used
func (*ProtoSub2Status) MarshalBinary ¶
func (m *ProtoSub2Status) MarshalBinary() ([]byte, error)
MarshalBinary interface implementation
func (*ProtoSub2Status) UnmarshalBinary ¶
func (m *ProtoSub2Status) UnmarshalBinary(b []byte) error
UnmarshalBinary interface implementation
type ProtoSubStatus ¶
type ProtoSubStatus struct {
// code
Code int32 `json:"code,omitempty"`
// message
Message string `json:"message,omitempty"`
}
ProtoSubStatus Status message in sub package
swagger:model protoSubStatus
func (*ProtoSubStatus) ContextValidate ¶
ContextValidate validates this proto sub status based on context it is used
func (*ProtoSubStatus) MarshalBinary ¶
func (m *ProtoSubStatus) MarshalBinary() ([]byte, error)
MarshalBinary interface implementation
func (*ProtoSubStatus) UnmarshalBinary ¶
func (m *ProtoSubStatus) UnmarshalBinary(b []byte) error
UnmarshalBinary interface implementation
type ProtobufAny ¶
type ProtobufAny struct {
// A URL/resource name that uniquely identifies the type of the serialized
// protocol buffer message. This string must contain at least
// one "/" character. The last segment of the URL's path must represent
// the fully qualified name of the type (as in
// `path/google.protobuf.Duration`). The name should be in a canonical form
// (e.g., leading "." is not accepted).
//
// In practice, teams usually precompile into the binary all types that they
// expect it to use in the context of Any. However, for URLs which use the
// scheme `http`, `https`, or no scheme, one can optionally set up a type
// server that maps type URLs to message definitions as follows:
//
// * If no scheme is provided, `https` is assumed.
// * An HTTP GET on the URL must yield a [google.protobuf.Type][]
// value in binary format, or produce an error.
// * Applications are allowed to cache lookup results based on the
// URL, or have them precompiled into a binary to avoid any
// lookup. Therefore, binary compatibility needs to be preserved
// on changes to types. (Use versioned type names to manage
// breaking changes.)
//
// Note: this functionality is not currently available in the official
// protobuf release, and it is not used for type URLs beginning with
// type.googleapis.com. As of May 2023, there are no widely used type server
// implementations and no plans to implement one.
//
// Schemes other than `http`, `https` (or the empty scheme) might be
// used with implementation specific semantics.
AtType string `json:"@type,omitempty"`
// protobuf any additional properties
ProtobufAnyAdditionalProperties map[string]any `json:"-"`
}
ProtobufAny `Any` contains an arbitrary serialized protocol buffer message along with a URL that describes the type of the serialized message.
Protobuf library provides support to pack/unpack Any values in the form of utility functions or additional generated methods of the Any type.
Example 1: Pack and unpack a message in C++.
Foo foo = ...;
Any any;
any.PackFrom(foo);
...
if (any.UnpackTo(&foo)) {
...
}
Example 2: Pack and unpack a message in Java.
Foo foo = ...;
Any any = Any.pack(foo);
...
if (any.is(Foo.class)) {
foo = any.unpack(Foo.class);
}
// or ...
if (any.isSameTypeAs(Foo.getDefaultInstance())) {
foo = any.unpack(Foo.getDefaultInstance());
}
Example 3: Pack and unpack a message in Python.
foo = Foo(...)
any = Any()
any.Pack(foo)
...
if any.Is(Foo.DESCRIPTOR):
any.Unpack(foo)
...
Example 4: Pack and unpack a message in Go
foo := &pb.Foo{...}
any, err := anypb.New(foo)
if err != nil {
...
}
...
foo := &pb.Foo{}
if err := any.UnmarshalTo(foo); err != nil {
...
}
The pack methods provided by protobuf library will by default use 'type.googleapis.com/full.type.name' as the type URL and the unpack methods only use the fully qualified type name after the last '/' in the type URL, for example "foo.bar.com/x/y.z" will yield type name "y.z".
JSON ==== The JSON representation of an `Any` value uses the regular representation of the deserialized, embedded message, with an additional field `@type` which contains the type URL. Example:
package google.profile;
message Person {
string first_name = 1;
string last_name = 2;
}
{
"@type": "type.googleapis.com/google.profile.Person",
"firstName": <string>,
"lastName": <string>
}
If the embedded message type is well-known and has a custom JSON representation, that representation will be embedded adding a field `value` which holds the custom JSON in addition to the `@type` field. Example (for message [google.protobuf.Duration][]):
{
"@type": "type.googleapis.com/google.protobuf.Duration",
"value": "1.212s"
}
swagger:model protobufAny
func (*ProtobufAny) ContextValidate ¶
ContextValidate validates this protobuf any based on context it is used
func (*ProtobufAny) MarshalBinary ¶
func (m *ProtobufAny) MarshalBinary() ([]byte, error)
MarshalBinary interface implementation
func (ProtobufAny) MarshalJSON ¶
func (m ProtobufAny) MarshalJSON() ([]byte, error)
MarshalJSON marshals this object with additional properties into a JSON object
func (*ProtobufAny) UnmarshalBinary ¶
func (m *ProtobufAny) UnmarshalBinary(b []byte) error
UnmarshalBinary interface implementation
func (*ProtobufAny) UnmarshalJSON ¶
func (m *ProtobufAny) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals this object with additional properties from JSON
type ProtobufNullValue ¶
type ProtobufNullValue string
ProtobufNullValue `NullValue` is a singleton enumeration to represent the null value for the `Value` type union.
The JSON representation for `NullValue` is JSON `null`.
- NULL_VALUE: Null value.
swagger:model protobufNullValue
const ( // ProtobufNullValueNULLVALUE captures enum value "NULL_VALUE" ProtobufNullValueNULLVALUE ProtobufNullValue = "NULL_VALUE" )
func NewProtobufNullValue ¶
func NewProtobufNullValue(value ProtobufNullValue) *ProtobufNullValue
func (ProtobufNullValue) ContextValidate ¶
ContextValidate validates this protobuf null value based on context it is used
func (ProtobufNullValue) Pointer ¶
func (m ProtobufNullValue) Pointer() *ProtobufNullValue
Pointer returns a pointer to a freshly-allocated ProtobufNullValue.
Source Files
¶
- examplepb_dynamic_message.go
- examplepb_dynamic_message_update.go
- examplepb_embedded.go
- examplepb_nested_message.go
- examplepb_simple_message.go
- examplepb_status_check_request.go
- examplepb_status_check_response.go
- google_rpc_status.go
- proto_sub2_status.go
- proto_sub_status.go
- protobuf_any.go
- protobuf_null_value.go