Documentation ¶
Index ¶
- Variables
- func Await(conn Conn) (err error)
- func Call(conn Conn, name string, args ...any) (err error)
- func Command(conn Conn, method string, args ...any) (err error)
- func Decode[R any](conn Conn) (r R, err error)
- func JsonCodecs(rw io.ReadWriter) (e Encoder, d Decoder, m Marshal, u Unmarshal)
- func Query[R any](conn Conn, method string, args ...any) (r R, err error)
- func Subscribe[R any](conn Conn, method string, args ...any) (c <-chan R, err error)
- type App
- type ArgsDecoder
- type ByteScannerReader
- type Caller
- type Codecs
- type Conn
- type ConnLogger
- type Decoder
- type Encoder
- type Failure
- type Flow
- type Handlers
- type Marshal
- type Registry
- func (n *Registry[V]) Add(str string, v V)
- func (n *Registry[V]) All() map[string]V
- func (n *Registry[V]) Get() V
- func (n *Registry[V]) HasNext() bool
- func (n *Registry[V]) IsEmpty() bool
- func (n *Registry[V]) Scan(scanner io.ByteScanner) (rr *Registry[V], err error)
- func (n *Registry[V]) Unfold(str string) (*Registry[V], string)
- type RemoteIdInfo
- type Request
- type Router
- func (r *Router) Authorize(ctx context.Context, query any) bool
- func (r *Router) Call() (result []any, err error)
- func (r *Router) Caller(caller *Caller) *Router
- func (r *Router) Command(cmd string) *Router
- func (r *Router) Conn(conn io.ReadWriteCloser) *Router
- func (r *Router) Func(name string, function any) *Router
- func (r *Router) Handle(ctx context.Context, query any, remoteId id.Identity, conn io.ReadWriteCloser) (err error)
- func (r *Router) Interface(srv any) *Router
- func (r *Router) Logger(logger plog.Logger) *Router
- func (r *Router) Query(query string) *Router
- func (r *Router) RouteFunc(name string, function any) *Router
- func (r *Router) RouteMap(handlers Handlers) *Router
- func (r *Router) Routes(routes ...string) *Router
- func (r *Router) Run(ctx context.Context) (err error)
- func (r *Router) Start(ctx context.Context) (err error)
- func (r *Router) With(env ...any) *Router
- type Serializer
- type Unmarshal
Constants ¶
This section is empty.
Variables ¶
View Source
var EmptyResponse = struct{}{}
View Source
var ErrNoHandler = errors.New("no handler for query")
Functions ¶
func JsonCodecs ¶
Types ¶
type ArgsDecoder ¶
type ArgsDecoder interface { Test([]byte) bool TestScan(scanner io.ByteScanner) bool Unmarshal(bytes []byte, args []any) error Decode(conn ByteScannerReader, args []any) error }
func NewClirArgsDecoder ¶
func NewClirArgsDecoder() ArgsDecoder
func NewJsonArgsDecoder ¶
func NewJsonArgsDecoder() ArgsDecoder
type ByteScannerReader ¶
type ByteScannerReader interface { io.Reader io.ByteScanner Append(bytes []byte) Clear() IsEmpty() bool Buffer() []byte }
func NewByteScannerReader ¶
func NewByteScannerReader(reader io.Reader) ByteScannerReader
type Caller ¶
type Caller struct {
// contains filtered or unexported fields
}
func (*Caller) Decoder ¶
func (c *Caller) Decoder(decoders ...ArgsDecoder) *Caller
func (*Caller) Decoders ¶
func (c *Caller) Decoders(decoders []ArgsDecoder) *Caller
type Conn ¶
type ConnLogger ¶
type ConnLogger struct { io.ReadWriteCloser plog.Logger }
func NewConnLogger ¶
func NewConnLogger(conn io.ReadWriteCloser, logger plog.Logger) *ConnLogger
type Flow ¶
type Flow struct{ *Serializer }
func NewFlow ¶
func NewFlow(conn io.ReadWriteCloser) *Flow
type Registry ¶
type Registry[V any] struct { // contains filtered or unexported fields }
func NewRegistry ¶
type RemoteIdInfo ¶
type Request ¶
type Request struct { *Serializer // contains filtered or unexported fields }
type Router ¶
type Router struct { Port string Registry *Registry[*Caller] RegisterRoute func(route string) (func(ctx context.Context), error) // contains filtered or unexported fields }
type Serializer ¶
type Serializer struct { io.WriteCloser ByteScannerReader // contains filtered or unexported fields }
func (*Serializer) Codecs ¶
func (s *Serializer) Codecs(codecs Codecs)
func (*Serializer) Decode ¶
func (s *Serializer) Decode(value any) (err error)
func (*Serializer) Encode ¶
func (s *Serializer) Encode(value any) (err error)
func (*Serializer) Logger ¶
func (s *Serializer) Logger(logger plog.Logger)
func (*Serializer) RemoteIdentity ¶
func (s *Serializer) RemoteIdentity() (i id.Identity)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.