prototool

package
v17.7.0-rc42 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_internal_tool_prototool_prototool_proto protoreflect.FileDescriptor

Functions

func BoolPtr

func BoolPtr(b **bool, defaultValue bool)

func Duration

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

func Float64

func Float64(s *float64, defaultValue float64)

func HeaderKVToHTTPHeader added in v17.5.2

func HeaderKVToHTTPHeader(from []*HeaderKV) http.Header

HeaderKVToHTTPHeader converts the internal []*HeaderKV type to http.Header. The returned http.Header has canonicalized keys.

func NotNil

func NotNil(field any)

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 ParseYAMLToProto added in v17.7.0

func ParseYAMLToProto(rawYAML []byte, msg proto.Message) error

func QueryKVToURLValues added in v17.5.2

func QueryKVToURLValues(from []*QueryKV) url.Values

func String

func String(s *string, defaultValue string)

func StringPtr

func StringPtr(s **string, defaultValue string)

func Uint32

func Uint32(d *uint32, defaultValue uint32)

func Uint64 added in v17.7.0

func Uint64(d *uint64, defaultValue uint64)

func UnmarshalProto added in v17.5.0

func UnmarshalProto(opts proto.UnmarshalOptions, data mem.BufferSlice, v any) error

Types

type HeaderKV added in v17.5.2

type HeaderKV struct {
	Key   []byte        `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	Value *HeaderValues `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

func HTTPHeaderToHeaderKV added in v17.5.2

func HTTPHeaderToHeaderKV(from http.Header) []*HeaderKV

func (*HeaderKV) Descriptor deprecated added in v17.5.2

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

Deprecated: Use HeaderKV.ProtoReflect.Descriptor instead.

func (*HeaderKV) GetKey added in v17.5.2

func (x *HeaderKV) GetKey() []byte

func (*HeaderKV) GetValue added in v17.5.2

func (x *HeaderKV) GetValue() *HeaderValues

func (*HeaderKV) ProtoMessage added in v17.5.2

func (*HeaderKV) ProtoMessage()

func (*HeaderKV) ProtoReflect added in v17.5.2

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

func (*HeaderKV) Reset added in v17.5.2

func (x *HeaderKV) Reset()

func (*HeaderKV) String added in v17.5.2

func (x *HeaderKV) String() string

type HeaderValues added in v17.1.0

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

func (*HeaderValues) Descriptor deprecated added in v17.1.0

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

Deprecated: Use HeaderValues.ProtoReflect.Descriptor instead.

func (*HeaderValues) GetValue added in v17.1.0

func (x *HeaderValues) GetValue() [][]byte

func (*HeaderValues) ProtoMessage added in v17.1.0

func (*HeaderValues) ProtoMessage()

func (*HeaderValues) ProtoReflect added in v17.1.0

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

func (*HeaderValues) Reset added in v17.1.0

func (x *HeaderValues) Reset()

func (*HeaderValues) String added in v17.1.0

func (x *HeaderValues) String() string

type HttpRequest

type HttpRequest struct {
	Method  string      `protobuf:"bytes,1,opt,name=method,proto3" json:"method,omitempty"`
	Header  []*HeaderKV `protobuf:"bytes,2,rep,name=header,proto3" json:"header,omitempty"`
	UrlPath string      `protobuf:"bytes,3,opt,name=url_path,json=urlPath,proto3" json:"url_path,omitempty"`
	Query   []*QueryKV  `protobuf:"bytes,4,rep,name=query,proto3" json:"query,omitempty"`
	// 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() []*HeaderKV

func (*HttpRequest) GetMethod

func (x *HttpRequest) GetMethod() string

func (*HttpRequest) GetQuery

func (x *HttpRequest) GetQuery() []*QueryKV

func (*HttpRequest) GetUrlPath

func (x *HttpRequest) GetUrlPath() string

func (*HttpRequest) HTTPHeader

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

func (*HttpRequest) IsUpgrade

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

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     []*HeaderKV `protobuf:"bytes,3,rep,name=header,proto3" json:"header,omitempty"`
	// 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() []*HeaderKV

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

type NopValidator added in v17.3.0

type NopValidator struct{}

func (NopValidator) Validate added in v17.3.0

func (v NopValidator) Validate(proto.Message) error

type ProtoErrMarshaler

type ProtoErrMarshaler struct {
}

func (ProtoErrMarshaler) Marshal

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

func (ProtoErrMarshaler) Unmarshal

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

type QueryKV added in v17.5.2

type QueryKV struct {
	Key   []byte       `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	Value *QueryValues `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

func URLValuesToQueryKV added in v17.5.2

func URLValuesToQueryKV(from url.Values) []*QueryKV

func (*QueryKV) Descriptor deprecated added in v17.5.2

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

Deprecated: Use QueryKV.ProtoReflect.Descriptor instead.

func (*QueryKV) GetKey added in v17.5.2

func (x *QueryKV) GetKey() []byte

func (*QueryKV) GetValue added in v17.5.2

func (x *QueryKV) GetValue() *QueryValues

func (*QueryKV) ProtoMessage added in v17.5.2

func (*QueryKV) ProtoMessage()

func (*QueryKV) ProtoReflect added in v17.5.2

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

func (*QueryKV) Reset added in v17.5.2

func (x *QueryKV) Reset()

func (*QueryKV) String added in v17.5.2

func (x *QueryKV) String() string

type QueryValues added in v17.1.0

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

func (*QueryValues) Descriptor deprecated added in v17.1.0

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

Deprecated: Use QueryValues.ProtoReflect.Descriptor instead.

func (*QueryValues) GetValue added in v17.1.0

func (x *QueryValues) GetValue() [][]byte

func (*QueryValues) ProtoMessage added in v17.1.0

func (*QueryValues) ProtoMessage()

func (*QueryValues) ProtoReflect added in v17.1.0

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

func (*QueryValues) Reset added in v17.1.0

func (x *QueryValues) Reset()

func (*QueryValues) String added in v17.1.0

func (x *QueryValues) String() string

type Validator added in v17.3.0

type Validator interface {
	Validate(proto.Message) error
}

Validator is a validator of protobuf messages.

Jump to

Keyboard shortcuts

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