server

package
v2.15.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServiceGoTSRPCProxyCustomError       = "CustomError"
	ServiceGoTSRPCProxyError             = "Error"
	ServiceGoTSRPCProxyErrors            = "Errors"
	ServiceGoTSRPCProxyMultiScalar       = "MultiScalar"
	ServiceGoTSRPCProxyScalar            = "Scalar"
	ServiceGoTSRPCProxyScalarError       = "ScalarError"
	ServiceGoTSRPCProxyStruct            = "Struct"
	ServiceGoTSRPCProxyStructError       = "StructError"
	ServiceGoTSRPCProxyTypedCustomError  = "TypedCustomError"
	ServiceGoTSRPCProxyTypedError        = "TypedError"
	ServiceGoTSRPCProxyTypedScalarError  = "TypedScalarError"
	ServiceGoTSRPCProxyTypedWrappedError = "TypedWrappedError"
	ServiceGoTSRPCProxyWrappedError      = "WrappedError"
)
View Source
const (
	ScalarOne ScalarError = "one"
	ScalarTwo ScalarError = "two"

	ScalarAOne ScalarA = "one"
	ScalarATwo ScalarA = "two"

	ScalarBThree ScalarB = "three"
	ScalarBFour  ScalarB = "four"
)

Variables

View Source
var (
	ErrTyped     = errors.New("typed error")
	ErrCustom    = NewMyCustomError("typed custom error")
	ErrScalarOne = NewMyScalarError(MyScalarErrorOne)
	ErrScalarTwo = NewMyScalarError(MyScalarErrorTwo)
)

Functions

This section is empty.

Types

type ErrService

type ErrService string
const (
	ErrUnauthorized ErrService = "unauthorized"
)

type HTTPServiceGoTSRPCClient

type HTTPServiceGoTSRPCClient struct {
	URL      string
	EndPoint string
	Client   gotsrpc.Client
}

func NewDefaultServiceGoTSRPCClient

func NewDefaultServiceGoTSRPCClient(url string) *HTTPServiceGoTSRPCClient

func NewServiceGoTSRPCClient

func NewServiceGoTSRPCClient(url string, endpoint string) *HTTPServiceGoTSRPCClient

func NewServiceGoTSRPCClientWithClient

func NewServiceGoTSRPCClientWithClient(url string, endpoint string, client *go_net_http.Client) *HTTPServiceGoTSRPCClient

func (*HTTPServiceGoTSRPCClient) CustomError

func (tsc *HTTPServiceGoTSRPCClient) CustomError(ctx go_context.Context) (e error, clientErr error)

func (*HTTPServiceGoTSRPCClient) Error

func (tsc *HTTPServiceGoTSRPCClient) Error(ctx go_context.Context) (e error, clientErr error)

func (*HTTPServiceGoTSRPCClient) Errors

func (tsc *HTTPServiceGoTSRPCClient) Errors(ctx go_context.Context) (e1 error, e2 error, clientErr error)

func (*HTTPServiceGoTSRPCClient) MultiScalar

func (tsc *HTTPServiceGoTSRPCClient) MultiScalar(ctx go_context.Context) (e *MultiScalar, clientErr error)

func (*HTTPServiceGoTSRPCClient) Scalar

func (tsc *HTTPServiceGoTSRPCClient) Scalar(ctx go_context.Context) (e *ScalarError, clientErr error)

func (*HTTPServiceGoTSRPCClient) ScalarError

func (tsc *HTTPServiceGoTSRPCClient) ScalarError(ctx go_context.Context) (e error, clientErr error)

func (*HTTPServiceGoTSRPCClient) Struct

func (tsc *HTTPServiceGoTSRPCClient) Struct(ctx go_context.Context) (e *StructError, clientErr error)

func (*HTTPServiceGoTSRPCClient) StructError

func (tsc *HTTPServiceGoTSRPCClient) StructError(ctx go_context.Context) (e error, clientErr error)

func (*HTTPServiceGoTSRPCClient) TypedCustomError

func (tsc *HTTPServiceGoTSRPCClient) TypedCustomError(ctx go_context.Context) (e error, clientErr error)

func (*HTTPServiceGoTSRPCClient) TypedError

func (tsc *HTTPServiceGoTSRPCClient) TypedError(ctx go_context.Context) (e error, clientErr error)

func (*HTTPServiceGoTSRPCClient) TypedScalarError

func (tsc *HTTPServiceGoTSRPCClient) TypedScalarError(ctx go_context.Context) (e error, clientErr error)

func (*HTTPServiceGoTSRPCClient) TypedWrappedError

func (tsc *HTTPServiceGoTSRPCClient) TypedWrappedError(ctx go_context.Context) (e error, clientErr error)

func (*HTTPServiceGoTSRPCClient) WrappedError

func (tsc *HTTPServiceGoTSRPCClient) WrappedError(ctx go_context.Context) (e error, clientErr error)

type Handler

type Handler struct{}

func New

func New() *Handler

func (*Handler) CustomError

func (h *Handler) CustomError(w http.ResponseWriter, r *http.Request) (e error)

func (*Handler) Error

func (h *Handler) Error(w http.ResponseWriter, r *http.Request) (e error)

func (*Handler) Errors

func (h *Handler) Errors(w http.ResponseWriter, r *http.Request) (e1 error, e2 error)

func (*Handler) MultiScalar

func (h *Handler) MultiScalar(w http.ResponseWriter, r *http.Request) (e *MultiScalar)

func (*Handler) Scalar

func (h *Handler) Scalar(w http.ResponseWriter, r *http.Request) (e *ScalarError)

func (*Handler) ScalarError

func (h *Handler) ScalarError(w http.ResponseWriter, r *http.Request) (e error)

func (*Handler) Struct

func (h *Handler) Struct(w http.ResponseWriter, r *http.Request) (e *StructError)

func (*Handler) StructError

func (h *Handler) StructError(w http.ResponseWriter, r *http.Request) (e error)

func (*Handler) TypedCustomError

func (h *Handler) TypedCustomError(w http.ResponseWriter, r *http.Request) (e error)

func (*Handler) TypedError

func (h *Handler) TypedError(w http.ResponseWriter, r *http.Request) (e error)

func (*Handler) TypedScalarError

func (h *Handler) TypedScalarError(w http.ResponseWriter, r *http.Request) (e error)

func (*Handler) TypedWrappedError

func (h *Handler) TypedWrappedError(w http.ResponseWriter, r *http.Request) (e error)

func (*Handler) WrappedError

func (h *Handler) WrappedError(w http.ResponseWriter, r *http.Request) (e error)

type MultiScalar

type MultiScalar struct {
	ScalarA `json:",omitempty,inline"`
	ScalarB `json:",omitempty,inline"`
}

type MyCustomError

type MyCustomError struct {
	Msg    string
	Map    map[string]string
	Slice  []string
	Struct struct {
		A string
	}
}

func NewMyCustomError

func NewMyCustomError(msg string) *MyCustomError

func (*MyCustomError) Error

func (e *MyCustomError) Error() string

type MyScalarError

type MyScalarError string
const (
	MyScalarErrorOne MyScalarError = "scalar error one"
	MyScalarErrorTwo MyScalarError = "scalar error two"
)

func NewMyScalarError

func NewMyScalarError(e MyScalarError) *MyScalarError

func (*MyScalarError) Error

func (e *MyScalarError) Error() string

type MyStructError

type MyStructError struct {
	Msg    string
	Map    map[string]string
	Slice  []string
	Struct struct {
		A string
	}
}

func NewMyStructError

func NewMyStructError(msg string) MyStructError

func (MyStructError) Error

func (e MyStructError) Error() string

type ScalarA

type ScalarA string

type ScalarB

type ScalarB string

type ScalarError

type ScalarError string

func (*ScalarError) Error

func (s *ScalarError) Error() string

func (*ScalarError) String

func (s *ScalarError) String() string

type Service

type Service interface {
	Error(w http.ResponseWriter, r *http.Request) (e error)
	Errors(w http.ResponseWriter, r *http.Request) (e1 error, e2 error)
	Scalar(w http.ResponseWriter, r *http.Request) (e *ScalarError)
	MultiScalar(w http.ResponseWriter, r *http.Request) (e *MultiScalar)
	Struct(w http.ResponseWriter, r *http.Request) (e *StructError)
	StructError(w http.ResponseWriter, r *http.Request) (e error)
	TypedError(w http.ResponseWriter, r *http.Request) (e error)
	ScalarError(w http.ResponseWriter, r *http.Request) (e error)
	CustomError(w http.ResponseWriter, r *http.Request) (e error)
	WrappedError(w http.ResponseWriter, r *http.Request) (e error)
	TypedWrappedError(w http.ResponseWriter, r *http.Request) (e error)
	TypedScalarError(w http.ResponseWriter, r *http.Request) (e error)
	TypedCustomError(w http.ResponseWriter, r *http.Request) (e error)
}

type ServiceGoTSRPCClient

type ServiceGoTSRPCClient interface {
	CustomError(ctx go_context.Context) (e error, clientErr error)
	Error(ctx go_context.Context) (e error, clientErr error)
	Errors(ctx go_context.Context) (e1 error, e2 error, clientErr error)
	MultiScalar(ctx go_context.Context) (e *MultiScalar, clientErr error)
	Scalar(ctx go_context.Context) (e *ScalarError, clientErr error)
	ScalarError(ctx go_context.Context) (e error, clientErr error)
	Struct(ctx go_context.Context) (e *StructError, clientErr error)
	StructError(ctx go_context.Context) (e error, clientErr error)
	TypedCustomError(ctx go_context.Context) (e error, clientErr error)
	TypedError(ctx go_context.Context) (e error, clientErr error)
	TypedScalarError(ctx go_context.Context) (e error, clientErr error)
	TypedWrappedError(ctx go_context.Context) (e error, clientErr error)
	WrappedError(ctx go_context.Context) (e error, clientErr error)
}

type ServiceGoTSRPCProxy

type ServiceGoTSRPCProxy struct {
	EndPoint string
	// contains filtered or unexported fields
}

func NewDefaultServiceGoTSRPCProxy

func NewDefaultServiceGoTSRPCProxy(service Service) *ServiceGoTSRPCProxy

func NewServiceGoTSRPCProxy

func NewServiceGoTSRPCProxy(service Service, endpoint string) *ServiceGoTSRPCProxy

func (*ServiceGoTSRPCProxy) ServeHTTP

func (p *ServiceGoTSRPCProxy) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP exposes your service

type StructError

type StructError struct {
	Message string `json:"message"`
	Data    string `json:"data"`
}

func (*StructError) Error

func (s *StructError) Error() string

Jump to

Keyboard shortcuts

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