rpc

package
v0.385.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const APIPathPrefix = "/twirp/rpc.API/"

APIPathPrefix is a convenience constant that may identify URL paths. Should be used with caution, it only matches routes generated by Twirp Go clients, with the default "/twirp" prefix and default CamelCase service and method names. More info: https://twitchtv.github.io/twirp/docs/routing.html

Variables

View Source
var (
	SQLQueryStatus_name = map[int32]string{
		0: "success",
		1: "failed",
	}
	SQLQueryStatus_value = map[string]int32{
		"success": 0,
		"failed":  1,
	}
)

Enum value maps for SQLQueryStatus.

Functions

func WriteError

func WriteError(resp http.ResponseWriter, err error)

WriteError writes an HTTP response with a valid Twirp error format (code, msg, meta). Useful outside of the Twirp server (e.g. http middleware), but does not trigger hooks. If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err)

Types

type API

func NewAPIJSONClient

func NewAPIJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) API

NewAPIJSONClient creates a JSON client that implements the API interface. It communicates using JSON and can be configured with a custom HTTPClient.

func NewAPIProtobufClient

func NewAPIProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) API

NewAPIProtobufClient creates a Protobuf client that implements the API interface. It communicates using Protobuf and can be configured with a custom HTTPClient.

type GetSchemaRequest

type GetSchemaRequest struct {
	EnvironmentId string `protobuf:"bytes,1,opt,name=environment_id,json=environmentId,proto3" json:"environment_id,omitempty"`
	// contains filtered or unexported fields
}

func (*GetSchemaRequest) Descriptor deprecated

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

Deprecated: Use GetSchemaRequest.ProtoReflect.Descriptor instead.

func (*GetSchemaRequest) GetEnvironmentId

func (x *GetSchemaRequest) GetEnvironmentId() string

func (*GetSchemaRequest) ProtoMessage

func (*GetSchemaRequest) ProtoMessage()

func (*GetSchemaRequest) ProtoReflect

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

func (*GetSchemaRequest) Reset

func (x *GetSchemaRequest) Reset()

func (*GetSchemaRequest) String

func (x *GetSchemaRequest) String() string

type GetSchemaResponse

type GetSchemaResponse struct {
	Schema *proto.Schema `protobuf:"bytes,1,opt,name=schema,proto3" json:"schema,omitempty"`
	// contains filtered or unexported fields
}

func (*GetSchemaResponse) Descriptor deprecated

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

Deprecated: Use GetSchemaResponse.ProtoReflect.Descriptor instead.

func (*GetSchemaResponse) GetSchema

func (x *GetSchemaResponse) GetSchema() *proto.Schema

func (*GetSchemaResponse) ProtoMessage

func (*GetSchemaResponse) ProtoMessage()

func (*GetSchemaResponse) ProtoReflect

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

func (*GetSchemaResponse) Reset

func (x *GetSchemaResponse) Reset()

func (*GetSchemaResponse) String

func (x *GetSchemaResponse) String() string

type GetTraceRequest

type GetTraceRequest struct {
	TraceId string `protobuf:"bytes,1,opt,name=trace_id,json=traceId,proto3" json:"trace_id,omitempty"`
	// contains filtered or unexported fields
}

func (*GetTraceRequest) Descriptor deprecated

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

Deprecated: Use GetTraceRequest.ProtoReflect.Descriptor instead.

func (*GetTraceRequest) GetTraceId

func (x *GetTraceRequest) GetTraceId() string

func (*GetTraceRequest) ProtoMessage

func (*GetTraceRequest) ProtoMessage()

func (*GetTraceRequest) ProtoReflect

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

func (*GetTraceRequest) Reset

func (x *GetTraceRequest) Reset()

func (*GetTraceRequest) String

func (x *GetTraceRequest) String() string

type GetTraceResponse

type GetTraceResponse struct {
	Trace *v1.TracesData `protobuf:"bytes,1,opt,name=trace,proto3" json:"trace,omitempty"`
	// contains filtered or unexported fields
}

func (*GetTraceResponse) Descriptor deprecated

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

Deprecated: Use GetTraceResponse.ProtoReflect.Descriptor instead.

func (*GetTraceResponse) GetTrace

func (x *GetTraceResponse) GetTrace() *v1.TracesData

func (*GetTraceResponse) ProtoMessage

func (*GetTraceResponse) ProtoMessage()

func (*GetTraceResponse) ProtoReflect

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

func (*GetTraceResponse) Reset

func (x *GetTraceResponse) Reset()

func (*GetTraceResponse) String

func (x *GetTraceResponse) String() string

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClient is the interface used by generated clients to send HTTP requests. It is fulfilled by *(net/http).Client, which is sufficient for most users. Users can provide their own implementation for special retry policies.

HTTPClient implementations should not follow redirects. Redirects are automatically disabled if *(net/http).Client is passed to client constructors. See the withoutRedirects function in this file for more details.

type ListTraceFilter

type ListTraceFilter struct {
	Field string `protobuf:"bytes,1,opt,name=field,proto3" json:"field,omitempty"`
	Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

func (*ListTraceFilter) Descriptor deprecated

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

Deprecated: Use ListTraceFilter.ProtoReflect.Descriptor instead.

func (*ListTraceFilter) GetField

func (x *ListTraceFilter) GetField() string

func (*ListTraceFilter) GetValue

func (x *ListTraceFilter) GetValue() string

func (*ListTraceFilter) ProtoMessage

func (*ListTraceFilter) ProtoMessage()

func (*ListTraceFilter) ProtoReflect

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

func (*ListTraceFilter) Reset

func (x *ListTraceFilter) Reset()

func (*ListTraceFilter) String

func (x *ListTraceFilter) String() string

type ListTracesRequest

type ListTracesRequest struct {
	EnvironmentId string                 `protobuf:"bytes,1,opt,name=environment_id,json=environmentId,proto3" json:"environment_id,omitempty"`
	Before        *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=before,proto3" json:"before,omitempty"`
	After         *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=after,proto3" json:"after,omitempty"`
	Filters       []*ListTraceFilter     `protobuf:"bytes,4,rep,name=filters,proto3" json:"filters,omitempty"`
	Limit         int32                  `protobuf:"varint,5,opt,name=limit,proto3" json:"limit,omitempty"`
	Offset        int32                  `protobuf:"varint,6,opt,name=offset,proto3" json:"offset,omitempty"`
	// contains filtered or unexported fields
}

func (*ListTracesRequest) Descriptor deprecated

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

Deprecated: Use ListTracesRequest.ProtoReflect.Descriptor instead.

func (*ListTracesRequest) GetAfter

func (x *ListTracesRequest) GetAfter() *timestamppb.Timestamp

func (*ListTracesRequest) GetBefore

func (x *ListTracesRequest) GetBefore() *timestamppb.Timestamp

func (*ListTracesRequest) GetEnvironmentId

func (x *ListTracesRequest) GetEnvironmentId() string

func (*ListTracesRequest) GetFilters

func (x *ListTracesRequest) GetFilters() []*ListTraceFilter

func (*ListTracesRequest) GetLimit

func (x *ListTracesRequest) GetLimit() int32

func (*ListTracesRequest) GetOffset

func (x *ListTracesRequest) GetOffset() int32

func (*ListTracesRequest) ProtoMessage

func (*ListTracesRequest) ProtoMessage()

func (*ListTracesRequest) ProtoReflect

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

func (*ListTracesRequest) Reset

func (x *ListTracesRequest) Reset()

func (*ListTracesRequest) String

func (x *ListTracesRequest) String() string

type ListTracesResponse

type ListTracesResponse struct {
	Traces []*TraceItem `protobuf:"bytes,1,rep,name=traces,proto3" json:"traces,omitempty"`
	// contains filtered or unexported fields
}

func (*ListTracesResponse) Descriptor deprecated

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

Deprecated: Use ListTracesResponse.ProtoReflect.Descriptor instead.

func (*ListTracesResponse) GetTraces

func (x *ListTracesResponse) GetTraces() []*TraceItem

func (*ListTracesResponse) ProtoMessage

func (*ListTracesResponse) ProtoMessage()

func (*ListTracesResponse) ProtoReflect

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

func (*ListTracesResponse) Reset

func (x *ListTracesResponse) Reset()

func (*ListTracesResponse) String

func (x *ListTracesResponse) String() string

type SQLQueryInput

type SQLQueryInput struct {
	ProjectID     string `protobuf:"bytes,1,opt,name=projectID,proto3" json:"projectID,omitempty"`
	EnvironmentID string `protobuf:"bytes,2,opt,name=environmentID,proto3" json:"environmentID,omitempty"`
	Query         string `protobuf:"bytes,3,opt,name=query,proto3" json:"query,omitempty"`
	// contains filtered or unexported fields
}

func (*SQLQueryInput) Descriptor deprecated

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

Deprecated: Use SQLQueryInput.ProtoReflect.Descriptor instead.

func (*SQLQueryInput) GetEnvironmentID

func (x *SQLQueryInput) GetEnvironmentID() string

func (*SQLQueryInput) GetProjectID

func (x *SQLQueryInput) GetProjectID() string

func (*SQLQueryInput) GetQuery

func (x *SQLQueryInput) GetQuery() string

func (*SQLQueryInput) ProtoMessage

func (*SQLQueryInput) ProtoMessage()

func (*SQLQueryInput) ProtoReflect

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

func (*SQLQueryInput) Reset

func (x *SQLQueryInput) Reset()

func (*SQLQueryInput) String

func (x *SQLQueryInput) String() string

type SQLQueryResponse

type SQLQueryResponse struct {
	Status            SQLQueryStatus `protobuf:"varint,1,opt,name=status,proto3,enum=rpc.SQLQueryStatus" json:"status,omitempty"`
	ExecutionDuration int32          `protobuf:"varint,2,opt,name=executionDuration,proto3" json:"executionDuration,omitempty"`
	ResultsJSON       string         `protobuf:"bytes,3,opt,name=resultsJSON,proto3" json:"resultsJSON,omitempty"`
	TotalRows         int32          `protobuf:"varint,4,opt,name=totalRows,proto3" json:"totalRows,omitempty"`
	Error             string         `protobuf:"bytes,5,opt,name=error,proto3" json:"error,omitempty"`
	// contains filtered or unexported fields
}

func (*SQLQueryResponse) Descriptor deprecated

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

Deprecated: Use SQLQueryResponse.ProtoReflect.Descriptor instead.

func (*SQLQueryResponse) GetError

func (x *SQLQueryResponse) GetError() string

func (*SQLQueryResponse) GetExecutionDuration

func (x *SQLQueryResponse) GetExecutionDuration() int32

func (*SQLQueryResponse) GetResultsJSON

func (x *SQLQueryResponse) GetResultsJSON() string

func (*SQLQueryResponse) GetStatus

func (x *SQLQueryResponse) GetStatus() SQLQueryStatus

func (*SQLQueryResponse) GetTotalRows

func (x *SQLQueryResponse) GetTotalRows() int32

func (*SQLQueryResponse) ProtoMessage

func (*SQLQueryResponse) ProtoMessage()

func (*SQLQueryResponse) ProtoReflect

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

func (*SQLQueryResponse) Reset

func (x *SQLQueryResponse) Reset()

func (*SQLQueryResponse) String

func (x *SQLQueryResponse) String() string

type SQLQueryStatus

type SQLQueryStatus int32
const (
	SQLQueryStatus_success SQLQueryStatus = 0
	SQLQueryStatus_failed  SQLQueryStatus = 1
)

func (SQLQueryStatus) Descriptor

func (SQLQueryStatus) Enum

func (x SQLQueryStatus) Enum() *SQLQueryStatus

func (SQLQueryStatus) EnumDescriptor deprecated

func (SQLQueryStatus) EnumDescriptor() ([]byte, []int)

Deprecated: Use SQLQueryStatus.Descriptor instead.

func (SQLQueryStatus) Number

func (SQLQueryStatus) String

func (x SQLQueryStatus) String() string

func (SQLQueryStatus) Type

type TraceItem

type TraceItem struct {
	TraceId        string                 `protobuf:"bytes,1,opt,name=trace_id,json=traceId,proto3" json:"trace_id,omitempty"`
	EnvironmentId  string                 `protobuf:"bytes,2,opt,name=environment_id,json=environmentId,proto3" json:"environment_id,omitempty"`
	StartTime      *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=start_time,json=startTime,proto3" json:"start_time,omitempty"`
	EndTime        *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=end_time,json=endTime,proto3" json:"end_time,omitempty"`
	Error          bool                   `protobuf:"varint,5,opt,name=error,proto3" json:"error,omitempty"`
	DurationMs     float32                `protobuf:"fixed32,6,opt,name=duration_ms,json=durationMs,proto3" json:"duration_ms,omitempty"`
	RootName       string                 `protobuf:"bytes,7,opt,name=root_name,json=rootName,proto3" json:"root_name,omitempty"`
	ProjectId      string                 `protobuf:"bytes,8,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"`
	DeploymentId   string                 `protobuf:"bytes,9,opt,name=deployment_id,json=deploymentId,proto3" json:"deployment_id,omitempty"`
	RuntimeVersion string                 `protobuf:"bytes,10,opt,name=runtime_version,json=runtimeVersion,proto3" json:"runtime_version,omitempty"`
	// contains filtered or unexported fields
}

func (*TraceItem) Descriptor deprecated

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

Deprecated: Use TraceItem.ProtoReflect.Descriptor instead.

func (*TraceItem) GetDeploymentId

func (x *TraceItem) GetDeploymentId() string

func (*TraceItem) GetDurationMs

func (x *TraceItem) GetDurationMs() float32

func (*TraceItem) GetEndTime

func (x *TraceItem) GetEndTime() *timestamppb.Timestamp

func (*TraceItem) GetEnvironmentId

func (x *TraceItem) GetEnvironmentId() string

func (*TraceItem) GetError

func (x *TraceItem) GetError() bool

func (*TraceItem) GetProjectId

func (x *TraceItem) GetProjectId() string

func (*TraceItem) GetRootName

func (x *TraceItem) GetRootName() string

func (*TraceItem) GetRuntimeVersion

func (x *TraceItem) GetRuntimeVersion() string

func (*TraceItem) GetStartTime

func (x *TraceItem) GetStartTime() *timestamppb.Timestamp

func (*TraceItem) GetTraceId

func (x *TraceItem) GetTraceId() string

func (*TraceItem) ProtoMessage

func (*TraceItem) ProtoMessage()

func (*TraceItem) ProtoReflect

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

func (*TraceItem) Reset

func (x *TraceItem) Reset()

func (*TraceItem) String

func (x *TraceItem) String() string

type TwirpServer

type TwirpServer interface {
	http.Handler

	// ServiceDescriptor returns gzipped bytes describing the .proto file that
	// this service was generated from. Once unzipped, the bytes can be
	// unmarshalled as a
	// google.golang.org/protobuf/types/descriptorpb.FileDescriptorProto.
	//
	// The returned integer is the index of this particular service within that
	// FileDescriptorProto's 'Service' slice of ServiceDescriptorProtos. This is a
	// low-level field, expected to be used for reflection.
	ServiceDescriptor() ([]byte, int)

	// ProtocGenTwirpVersion is the semantic version string of the version of
	// twirp used to generate this file.
	ProtocGenTwirpVersion() string

	// PathPrefix returns the HTTP URL path prefix for all methods handled by this
	// service. This can be used with an HTTP mux to route Twirp requests.
	// The path prefix is in the form: "/<prefix>/<package>.<Service>/"
	// that is, everything in a Twirp route except for the <Method> at the end.
	PathPrefix() string
}

TwirpServer is the interface generated server structs will support: they're HTTP handlers with additional methods for accessing metadata about the service. Those accessors are a low-level API for building reflection tools. Most people can think of TwirpServers as just http.Handlers.

func NewAPIServer

func NewAPIServer(svc API, opts ...interface{}) TwirpServer

NewAPIServer builds a TwirpServer that can be used as an http.Handler to handle HTTP requests that are routed to the right method in the provided svc implementation. The opts are twirp.ServerOption modifiers, for example twirp.WithServerHooks(hooks).

Jump to

Keyboard shortcuts

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