prototool

package
v15.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2022 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_internal_tool_prototool_prototool_proto protoreflect.FileDescriptor

Functions

func Duration

func Duration(d **durationpb.Duration, defaultValue time.Duration)

func Float64

func Float64(s *float64, defaultValue float64)

func HttpHeaderToValuesMap

func HttpHeaderToValuesMap(from http.Header) map[string]*Values

func Int32Ptr added in v15.4.0

func Int32Ptr(d **int32, defaultValue int32)

func NotNil

func NotNil(field interface{})

NotNil ensures that the memory that the field pointer is pointing to is not nil. field must be a valid pointer. It's target is checked for nil-ness and populated if it's nil.

func String

func String(s *string, defaultValue string)

func StringPtr added in v15.4.0

func StringPtr(s **string, defaultValue string)

func Uint32

func Uint32(d *uint32, defaultValue uint32)

func UrlValuesToValuesMap

func UrlValuesToValuesMap(from url.Values) map[string]*Values

func ValuesMapToHttpHeader

func ValuesMapToHttpHeader(from map[string]*Values) http.Header

func ValuesMapToUrlValues

func ValuesMapToUrlValues(from map[string]*Values) url.Values

Types

type HttpRequest

type HttpRequest struct {
	Method  string             `protobuf:"bytes,1,opt,name=method,proto3" json:"method,omitempty"`
	Header  map[string]*Values `` /* 153-byte string literal not displayed */
	UrlPath string             `protobuf:"bytes,3,opt,name=url_path,json=urlPath,proto3" json:"url_path,omitempty"`
	Query   map[string]*Values `` /* 151-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*HttpRequest) Descriptor deprecated

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

Deprecated: Use HttpRequest.ProtoReflect.Descriptor instead.

func (*HttpRequest) GetHeader

func (x *HttpRequest) GetHeader() map[string]*Values

func (*HttpRequest) GetMethod

func (x *HttpRequest) GetMethod() string

func (*HttpRequest) GetQuery

func (x *HttpRequest) GetQuery() map[string]*Values

func (*HttpRequest) GetUrlPath

func (x *HttpRequest) GetUrlPath() string

func (*HttpRequest) HttpHeader

func (x *HttpRequest) HttpHeader() http.Header

func (*HttpRequest) IsUpgrade added in v15.1.0

func (x *HttpRequest) IsUpgrade() bool

func (*HttpRequest) ProtoMessage

func (*HttpRequest) ProtoMessage()

func (*HttpRequest) ProtoReflect

func (x *HttpRequest) ProtoReflect() protoreflect.Message

func (*HttpRequest) Reset

func (x *HttpRequest) Reset()

func (*HttpRequest) String

func (x *HttpRequest) String() string

func (*HttpRequest) UrlQuery

func (x *HttpRequest) UrlQuery() url.Values

func (*HttpRequest) Validate

func (m *HttpRequest) Validate() error

Validate checks the field values on HttpRequest with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*HttpRequest) ValidateAll

func (m *HttpRequest) ValidateAll() error

ValidateAll checks the field values on HttpRequest with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in HttpRequestMultiError, or nil if none found.

type HttpRequestMultiError

type HttpRequestMultiError []error

HttpRequestMultiError is an error wrapping multiple validation errors returned by HttpRequest.ValidateAll() if the designated constraints aren't met.

func (HttpRequestMultiError) AllErrors

func (m HttpRequestMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (HttpRequestMultiError) Error

func (m HttpRequestMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type HttpRequestValidationError

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

HttpRequestValidationError is the validation error returned by HttpRequest.Validate if the designated constraints aren't met.

func (HttpRequestValidationError) Cause

Cause function returns cause value.

func (HttpRequestValidationError) Error

Error satisfies the builtin error interface

func (HttpRequestValidationError) ErrorName

func (e HttpRequestValidationError) ErrorName() string

ErrorName returns error name.

func (HttpRequestValidationError) Field

Field function returns field value.

func (HttpRequestValidationError) Key

Key function returns key value.

func (HttpRequestValidationError) Reason

Reason function returns reason value.

type HttpResponse

type HttpResponse struct {
	StatusCode int32              `protobuf:"varint,1,opt,name=status_code,json=statusCode,proto3" json:"status_code,omitempty"`
	Status     string             `protobuf:"bytes,2,opt,name=status,proto3" json:"status,omitempty"`
	Header     map[string]*Values `` /* 153-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*HttpResponse) Descriptor deprecated

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

Deprecated: Use HttpResponse.ProtoReflect.Descriptor instead.

func (*HttpResponse) GetHeader

func (x *HttpResponse) GetHeader() map[string]*Values

func (*HttpResponse) GetStatus

func (x *HttpResponse) GetStatus() string

func (*HttpResponse) GetStatusCode

func (x *HttpResponse) GetStatusCode() int32

func (*HttpResponse) HttpHeader

func (x *HttpResponse) HttpHeader() http.Header

func (*HttpResponse) ProtoMessage

func (*HttpResponse) ProtoMessage()

func (*HttpResponse) ProtoReflect

func (x *HttpResponse) ProtoReflect() protoreflect.Message

func (*HttpResponse) Reset

func (x *HttpResponse) Reset()

func (*HttpResponse) String

func (x *HttpResponse) String() string

func (*HttpResponse) Validate

func (m *HttpResponse) Validate() error

Validate checks the field values on HttpResponse with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*HttpResponse) ValidateAll

func (m *HttpResponse) ValidateAll() error

ValidateAll checks the field values on HttpResponse with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in HttpResponseMultiError, or nil if none found.

type HttpResponseMultiError

type HttpResponseMultiError []error

HttpResponseMultiError is an error wrapping multiple validation errors returned by HttpResponse.ValidateAll() if the designated constraints aren't met.

func (HttpResponseMultiError) AllErrors

func (m HttpResponseMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (HttpResponseMultiError) Error

func (m HttpResponseMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type HttpResponseValidationError

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

HttpResponseValidationError is the validation error returned by HttpResponse.Validate if the designated constraints aren't met.

func (HttpResponseValidationError) Cause

Cause function returns cause value.

func (HttpResponseValidationError) Error

Error satisfies the builtin error interface

func (HttpResponseValidationError) ErrorName

func (e HttpResponseValidationError) ErrorName() string

ErrorName returns error name.

func (HttpResponseValidationError) Field

Field function returns field value.

func (HttpResponseValidationError) Key

Key function returns key value.

func (HttpResponseValidationError) Reason

Reason function returns reason value.

type JsonBox

type JsonBox struct {
	Message proto.Message
}

JsonBox ensures the protojson package is used for to/from JSON marshaling. See https://pkg.go.dev/google.golang.org/protobuf/encoding/protojson.

func (JsonBox) MarshalJSON

func (b JsonBox) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler on JsonBox. It must have a value receiver to make it work on non-addressable values e.g.: - json.Marshal(JsonBox{...}) - json.Marshal(SomeTypeWhereJsonBoxIsNotAPointerField{...}) See https://golang.org/ref/spec#Address_operators.

func (*JsonBox) UnmarshalJSON

func (b *JsonBox) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler on JsonBox.

type ProtoErrMarshaler added in v15.5.0

type ProtoErrMarshaler struct {
}

func (ProtoErrMarshaler) Marshal added in v15.5.0

func (ProtoErrMarshaler) Marshal(err error) ([]byte, error)

func (ProtoErrMarshaler) Unmarshal added in v15.5.0

func (ProtoErrMarshaler) Unmarshal(data []byte) (error, error)

type Values

type Values struct {
	Value []string `protobuf:"bytes,1,rep,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

func (*Values) Descriptor deprecated

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

Deprecated: Use Values.ProtoReflect.Descriptor instead.

func (*Values) GetValue

func (x *Values) GetValue() []string

func (*Values) ProtoMessage

func (*Values) ProtoMessage()

func (*Values) ProtoReflect

func (x *Values) ProtoReflect() protoreflect.Message

func (*Values) Reset

func (x *Values) Reset()

func (*Values) String

func (x *Values) String() string

func (*Values) Validate

func (m *Values) Validate() error

Validate checks the field values on Values with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*Values) ValidateAll

func (m *Values) ValidateAll() error

ValidateAll checks the field values on Values with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in ValuesMultiError, or nil if none found.

type ValuesMultiError

type ValuesMultiError []error

ValuesMultiError is an error wrapping multiple validation errors returned by Values.ValidateAll() if the designated constraints aren't met.

func (ValuesMultiError) AllErrors

func (m ValuesMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (ValuesMultiError) Error

func (m ValuesMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type ValuesValidationError

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

ValuesValidationError is the validation error returned by Values.Validate if the designated constraints aren't met.

func (ValuesValidationError) Cause

func (e ValuesValidationError) Cause() error

Cause function returns cause value.

func (ValuesValidationError) Error

func (e ValuesValidationError) Error() string

Error satisfies the builtin error interface

func (ValuesValidationError) ErrorName

func (e ValuesValidationError) ErrorName() string

ErrorName returns error name.

func (ValuesValidationError) Field

func (e ValuesValidationError) Field() string

Field function returns field value.

func (ValuesValidationError) Key

func (e ValuesValidationError) Key() bool

Key function returns key value.

func (ValuesValidationError) Reason

func (e ValuesValidationError) Reason() string

Reason function returns reason value.

Jump to

Keyboard shortcuts

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