rpc

package
v1.0.37 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Status

type Status struct {

	// The status code, which should be an enum value of
	// [google.rpc.Code][google.rpc.Code].
	Code int32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty" firestore:"code"`
	// 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 `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty" firestore:"message"`
	// A list of messages that carry the error details.  There is a common set of
	// message types for APIs to use.
	Details []*anypb.Any `protobuf:"bytes,3,rep,name=details,proto3" json:"details,omitempty" firestore:"details"`
	// contains filtered or unexported fields
}

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). The error model is designed to be:

- Simple to use and understand for most users - Flexible enough to meet unexpected needs

Overview

The `Status` message contains three pieces of data: error code, error message, and error details. The error code should be an enum value of [google.rpc.Code][google.rpc.Code], but it may accept additional error codes if needed. The error message should be a developer-facing English message that helps developers *understand* and *resolve* the error. If a localized user-facing error message is needed, put the localized message in the error details or localize it in the client. The optional error details may contain arbitrary information about the error. There is a predefined set of error detail types in the package `google.rpc` that can be used for common error conditions.

Language mapping

The `Status` message is the logical representation of the error model, but it is not necessarily the actual wire format. When the `Status` message is exposed in different client libraries and different wire protocols, it can be mapped differently. For example, it will likely be mapped to some exceptions in Java, but more likely mapped to some error codes in C.

Other uses

The error model and the `Status` message can be used in a variety of environments, either with or without APIs, to provide a consistent developer experience across different environments.

Example uses of this error model include:

  • Partial errors. If a service needs to return partial errors to the client, it may embed the `Status` in the normal response to indicate the partial errors.
  • Workflow errors. A typical workflow has multiple steps. Each step may have a `Status` message for error reporting.
  • Batch operations. If a client uses batch request and batch response, the `Status` message should be used directly inside batch response, one for each error sub-response.
  • Asynchronous operations. If an API call embeds asynchronous operation results in its response, the status of those operations should be represented directly using the `Status` message.
  • Logging. If some API errors are stored in logs, the message `Status` could be used directly after any stripping needed for security/privacy reasons.

func (*Status) Clone

func (o *Status) Clone() *Status

func (*Status) CloneRaw

func (o *Status) CloneRaw() gotenobject.GotenObjectExt

func (*Status) Descriptor

func (*Status) Descriptor() ([]byte, []int)

Deprecated, Use Status.ProtoReflect.Descriptor instead.

func (*Status) GetCode

func (m *Status) GetCode() int32

func (*Status) GetDetails

func (m *Status) GetDetails() []*anypb.Any

func (*Status) GetMessage

func (m *Status) GetMessage() string

func (*Status) GotenMessage

func (*Status) GotenMessage()

func (*Status) GotenObjectExt

func (o *Status) GotenObjectExt()

func (*Status) GotenValidate

func (obj *Status) GotenValidate() error

func (*Status) MakeDiffFieldMask

func (o *Status) MakeDiffFieldMask(other *Status) *Status_FieldMask

func (*Status) MakeFullFieldMask

func (o *Status) MakeFullFieldMask() *Status_FieldMask

func (*Status) MakeRawDiffFieldMask

func (o *Status) MakeRawDiffFieldMask(other gotenobject.GotenObjectExt) gotenobject.FieldMask

func (*Status) MakeRawFullFieldMask

func (o *Status) MakeRawFullFieldMask() gotenobject.FieldMask

func (*Status) Marshal

func (m *Status) Marshal() ([]byte, error)

func (*Status) MarshalJSON

func (m *Status) MarshalJSON() ([]byte, error)

func (*Status) Merge

func (o *Status) Merge(source *Status)

func (*Status) MergeRaw

func (o *Status) MergeRaw(source gotenobject.GotenObjectExt)

func (*Status) ProtoMessage

func (*Status) ProtoMessage()

func (*Status) ProtoReflect

func (m *Status) ProtoReflect() preflect.Message

func (*Status) Reset

func (m *Status) Reset()

func (*Status) SetCode

func (m *Status) SetCode(fv int32)

func (*Status) SetDetails

func (m *Status) SetDetails(fv []*anypb.Any)

func (*Status) SetMessage

func (m *Status) SetMessage(fv string)

func (*Status) String

func (m *Status) String() string

func (*Status) Unmarshal

func (m *Status) Unmarshal(b []byte) error

func (*Status) UnmarshalJSON

func (m *Status) UnmarshalJSON(data []byte) error

type StatusFieldPathBuilder

type StatusFieldPathBuilder struct{}

func NewStatusFieldPathBuilder

func NewStatusFieldPathBuilder() StatusFieldPathBuilder

func (StatusFieldPathBuilder) Code

func (StatusFieldPathBuilder) Details

func (StatusFieldPathBuilder) Message

type StatusPathSelectorCode

type StatusPathSelectorCode struct{}

func (StatusPathSelectorCode) FieldPath

func (StatusPathSelectorCode) WithArrayOfValues

func (StatusPathSelectorCode) WithValue

type StatusPathSelectorDetails

type StatusPathSelectorDetails struct{}

func (StatusPathSelectorDetails) FieldPath

func (StatusPathSelectorDetails) WithArrayOfValues

func (StatusPathSelectorDetails) WithItemValue

func (StatusPathSelectorDetails) WithValue

type StatusPathSelectorMessage

type StatusPathSelectorMessage struct{}

func (StatusPathSelectorMessage) FieldPath

func (StatusPathSelectorMessage) WithArrayOfValues

func (StatusPathSelectorMessage) WithValue

type Status_FieldMask

type Status_FieldMask struct {
	Paths []Status_FieldPath
}

func FullStatus_FieldMask

func FullStatus_FieldMask() *Status_FieldMask

func (*Status_FieldMask) AppendPath

func (fieldMask *Status_FieldMask) AppendPath(path Status_FieldPath)

func (*Status_FieldMask) AppendRawPath

func (fieldMask *Status_FieldMask) AppendRawPath(path gotenobject.FieldPath)

func (*Status_FieldMask) DecodeFirestore

func (fieldMask *Status_FieldMask) DecodeFirestore(fpbv *firestorepb.Value) error

func (*Status_FieldMask) EncodeFirestore

func (fieldMask *Status_FieldMask) EncodeFirestore() (*firestorepb.Value, error)

firestore encoding/decoding integration

func (*Status_FieldMask) FilterInputFields

func (fieldMask *Status_FieldMask) FilterInputFields() *Status_FieldMask

FilterInputFields generates copy of field paths with output_only field paths removed

func (*Status_FieldMask) FromProtoFieldMask

func (fieldMask *Status_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error

func (*Status_FieldMask) GetPaths

func (fieldMask *Status_FieldMask) GetPaths() []Status_FieldPath

func (*Status_FieldMask) GetRawPaths

func (fieldMask *Status_FieldMask) GetRawPaths() []gotenobject.FieldPath

func (*Status_FieldMask) IsFull

func (fieldMask *Status_FieldMask) IsFull() bool

func (Status_FieldMask) Marshal

func (fieldMask Status_FieldMask) Marshal() ([]byte, error)

implement methods required by customType

func (Status_FieldMask) MarshalJSON

func (fieldMask Status_FieldMask) MarshalJSON() ([]byte, error)

func (*Status_FieldMask) PathsCount

func (fieldMask *Status_FieldMask) PathsCount() int

func (*Status_FieldMask) Project

func (fieldMask *Status_FieldMask) Project(source *Status) *Status

func (*Status_FieldMask) ProjectRaw

func (*Status_FieldMask) ProtoMessage

func (fieldMask *Status_FieldMask) ProtoMessage()

func (*Status_FieldMask) ProtoReflect

func (fieldMask *Status_FieldMask) ProtoReflect() preflect.Message

func (*Status_FieldMask) Reset

func (fieldMask *Status_FieldMask) Reset()

func (*Status_FieldMask) Set

func (fieldMask *Status_FieldMask) Set(target, source *Status)

func (*Status_FieldMask) SetFromCliFlag

func (fieldMask *Status_FieldMask) SetFromCliFlag(raw string) error

func (*Status_FieldMask) SetRaw

func (fieldMask *Status_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt)

func (*Status_FieldMask) Size

func (fieldMask *Status_FieldMask) Size() int

func (*Status_FieldMask) String

func (fieldMask *Status_FieldMask) String() string

func (*Status_FieldMask) Subtract

func (fieldMask *Status_FieldMask) Subtract(other *Status_FieldMask) *Status_FieldMask

func (*Status_FieldMask) SubtractRaw

func (fieldMask *Status_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask

func (*Status_FieldMask) ToProtoFieldMask

func (fieldMask *Status_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask

ToFieldMask is used for proto conversions

func (*Status_FieldMask) Unmarshal

func (fieldMask *Status_FieldMask) Unmarshal(data []byte) error

func (*Status_FieldMask) UnmarshalJSON

func (fieldMask *Status_FieldMask) UnmarshalJSON(data []byte) error

type Status_FieldPath

type Status_FieldPath interface {
	gotenobject.FieldPath
	Selector() Status_FieldPathSelector
	Get(source *Status) []interface{}
	GetSingle(source *Status) (interface{}, bool)
	ClearValue(item *Status)

	// Those methods build corresponding Status_FieldPathValue
	// (or array of values) and holds passed value. Panics if injected type is incorrect.
	WithIValue(value interface{}) Status_FieldPathValue
	WithIArrayOfValues(values interface{}) Status_FieldPathArrayOfValues
	WithIArrayItemValue(value interface{}) Status_FieldPathArrayItemValue
}

FieldPath provides implementation to handle https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto

func BuildStatus_FieldPath

func BuildStatus_FieldPath(fp gotenobject.RawFieldPath) (Status_FieldPath, error)

func MustParseStatus_FieldPath

func MustParseStatus_FieldPath(rawField string) Status_FieldPath

func ParseStatus_FieldPath

func ParseStatus_FieldPath(rawField string) (Status_FieldPath, error)

type Status_FieldPathArrayItemValue

type Status_FieldPathArrayItemValue interface {
	gotenobject.FieldPathArrayItemValue
	Status_FieldPath
	ContainsValue(*Status) bool
}

Status_FieldPathArrayItemValue allows storing single item in Path-specific values for Status according to their type Present only for array (repeated) types.

func MustParseStatus_FieldPathArrayItemValue

func MustParseStatus_FieldPathArrayItemValue(pathStr, valueStr string) Status_FieldPathArrayItemValue

func ParseStatus_FieldPathArrayItemValue

func ParseStatus_FieldPathArrayItemValue(pathStr, valueStr string) (Status_FieldPathArrayItemValue, error)

ParseStatus_FieldPathArrayItemValue parses string and JSON-encoded value to its Value

type Status_FieldPathArrayOfValues

type Status_FieldPathArrayOfValues interface {
	gotenobject.FieldPathArrayOfValues
	Status_FieldPath
}

Status_FieldPathArrayOfValues allows storing slice of values for Status fields according to their type

func MustParseStatus_FieldPathArrayOfValues

func MustParseStatus_FieldPathArrayOfValues(pathStr, valuesStr string) Status_FieldPathArrayOfValues

func ParseStatus_FieldPathArrayOfValues

func ParseStatus_FieldPathArrayOfValues(pathStr, valuesStr string) (Status_FieldPathArrayOfValues, error)

type Status_FieldPathSelector

type Status_FieldPathSelector int32
const (
	Status_FieldPathSelectorCode    Status_FieldPathSelector = 0
	Status_FieldPathSelectorMessage Status_FieldPathSelector = 1
	Status_FieldPathSelectorDetails Status_FieldPathSelector = 2
)

func (Status_FieldPathSelector) String

func (s Status_FieldPathSelector) String() string

type Status_FieldPathValue

type Status_FieldPathValue interface {
	Status_FieldPath
	gotenobject.FieldPathValue
	SetTo(target **Status)
	CompareWith(*Status) (cmp int, comparable bool)
}

Status_FieldPathValue allows storing values for Status fields according to their type

func MustParseStatus_FieldPathValue

func MustParseStatus_FieldPathValue(pathStr, valueStr string) Status_FieldPathValue

func ParseStatus_FieldPathValue

func ParseStatus_FieldPathValue(pathStr, valueStr string) (Status_FieldPathValue, error)

type Status_FieldTerminalPath

type Status_FieldTerminalPath struct {
	// contains filtered or unexported fields
}

func (*Status_FieldTerminalPath) ClearValue

func (fp *Status_FieldTerminalPath) ClearValue(item *Status)

func (*Status_FieldTerminalPath) ClearValueRaw

func (fp *Status_FieldTerminalPath) ClearValueRaw(item proto.Message)

func (*Status_FieldTerminalPath) Get

func (fp *Status_FieldTerminalPath) Get(source *Status) (values []interface{})

Get returns all values pointed by specific field from source Status

func (*Status_FieldTerminalPath) GetDefault

func (fp *Status_FieldTerminalPath) GetDefault() interface{}

GetDefault returns a default value of the field type

func (*Status_FieldTerminalPath) GetRaw

func (fp *Status_FieldTerminalPath) GetRaw(source proto.Message) []interface{}

func (*Status_FieldTerminalPath) GetSingle

func (fp *Status_FieldTerminalPath) GetSingle(source *Status) (interface{}, bool)

GetSingle returns value pointed by specific field of from source Status

func (*Status_FieldTerminalPath) GetSingleRaw

func (fp *Status_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool)

func (*Status_FieldTerminalPath) IsLeaf

func (fp *Status_FieldTerminalPath) IsLeaf() bool

IsLeaf - whether field path is holds simple value

func (*Status_FieldTerminalPath) JSONString

func (fp *Status_FieldTerminalPath) JSONString() string

JSONString returns path representation is JSON convention

func (*Status_FieldTerminalPath) Selector

func (*Status_FieldTerminalPath) SplitIntoTerminalIPaths added in v0.8.0

func (fp *Status_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath

func (*Status_FieldTerminalPath) String

func (fp *Status_FieldTerminalPath) String() string

String returns path representation in proto convention

func (*Status_FieldTerminalPath) WithIArrayItemValue

func (fp *Status_FieldTerminalPath) WithIArrayItemValue(value interface{}) Status_FieldPathArrayItemValue

func (*Status_FieldTerminalPath) WithIArrayOfValues

func (fp *Status_FieldTerminalPath) WithIArrayOfValues(values interface{}) Status_FieldPathArrayOfValues

func (*Status_FieldTerminalPath) WithIValue

func (fp *Status_FieldTerminalPath) WithIValue(value interface{}) Status_FieldPathValue

func (*Status_FieldTerminalPath) WithRawIArrayItemValue

func (fp *Status_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue

func (*Status_FieldTerminalPath) WithRawIArrayOfValues

func (fp *Status_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues

func (*Status_FieldTerminalPath) WithRawIValue

func (fp *Status_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue

type Status_FieldTerminalPathArrayItemValue

type Status_FieldTerminalPathArrayItemValue struct {
	Status_FieldTerminalPath
	// contains filtered or unexported fields
}

func (*Status_FieldTerminalPathArrayItemValue) AsDetailsItemValue

func (fpaiv *Status_FieldTerminalPathArrayItemValue) AsDetailsItemValue() (*anypb.Any, bool)

func (*Status_FieldTerminalPathArrayItemValue) ContainsValue

func (fpaiv *Status_FieldTerminalPathArrayItemValue) ContainsValue(source *Status) bool

Contains returns a boolean indicating if value that is being held is present in given 'Status'

func (*Status_FieldTerminalPathArrayItemValue) GetRawItemValue

func (fpaiv *Status_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{}

GetRawValue returns stored element value for array in object Status as interface{}

func (*Status_FieldTerminalPathArrayItemValue) GetSingle

func (fpaiv *Status_FieldTerminalPathArrayItemValue) GetSingle(source *Status) (interface{}, bool)

func (*Status_FieldTerminalPathArrayItemValue) GetSingleRaw

func (fpaiv *Status_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool)

type Status_FieldTerminalPathArrayOfValues

type Status_FieldTerminalPathArrayOfValues struct {
	Status_FieldTerminalPath
	// contains filtered or unexported fields
}

func (*Status_FieldTerminalPathArrayOfValues) AsCodeArrayOfValues

func (fpaov *Status_FieldTerminalPathArrayOfValues) AsCodeArrayOfValues() ([]int32, bool)

func (*Status_FieldTerminalPathArrayOfValues) AsDetailsArrayOfValues

func (fpaov *Status_FieldTerminalPathArrayOfValues) AsDetailsArrayOfValues() ([][]*anypb.Any, bool)

func (*Status_FieldTerminalPathArrayOfValues) AsMessageArrayOfValues

func (fpaov *Status_FieldTerminalPathArrayOfValues) AsMessageArrayOfValues() ([]string, bool)

func (*Status_FieldTerminalPathArrayOfValues) GetRawValues

func (fpaov *Status_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{})

type Status_FieldTerminalPathValue

type Status_FieldTerminalPathValue struct {
	Status_FieldTerminalPath
	// contains filtered or unexported fields
}

func (*Status_FieldTerminalPathValue) AsCodeValue

func (fpv *Status_FieldTerminalPathValue) AsCodeValue() (int32, bool)

func (*Status_FieldTerminalPathValue) AsDetailsValue

func (fpv *Status_FieldTerminalPathValue) AsDetailsValue() ([]*anypb.Any, bool)

func (*Status_FieldTerminalPathValue) AsMessageValue

func (fpv *Status_FieldTerminalPathValue) AsMessageValue() (string, bool)

func (*Status_FieldTerminalPathValue) CompareWith

func (fpv *Status_FieldTerminalPathValue) CompareWith(source *Status) (int, bool)

CompareWith compares value in the 'Status_FieldTerminalPathValue' with the value under path in 'Status'.

func (*Status_FieldTerminalPathValue) CompareWithRaw

func (fpv *Status_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool)

func (*Status_FieldTerminalPathValue) GetRawValue

func (fpv *Status_FieldTerminalPathValue) GetRawValue() interface{}

GetRawValue returns raw value stored under selected path for 'Status' as interface{}

func (*Status_FieldTerminalPathValue) SetTo

func (fpv *Status_FieldTerminalPathValue) SetTo(target **Status)

SetTo stores value for selected field for object Status

func (*Status_FieldTerminalPathValue) SetToRaw

func (fpv *Status_FieldTerminalPathValue) SetToRaw(target proto.Message)

Jump to

Keyboard shortcuts

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