Documentation ¶
Index ¶
- Constants
- func CtxValueMustBe[T any](c *CommandCtx, key string) (T, error)
- func CtxValueShouldBe[T any](c *CommandCtx, key string, defaultValue T) T
- func DecodeMap(raw []byte) map[string]any
- func EncodeMap(data any) []byte
- func GetCommandKey(id, method string) string
- func GetOutboundIP() (net.IP, error)
- type AllocatableResourceType
- type CommandCtx
- func (c *CommandCtx) JSON(data any, statusCode ...int) error
- func (c *CommandCtx) Read() []byte
- func (c *CommandCtx) ReadJSON(out any) error
- func (c *CommandCtx) Value(key string, newValue ...any) any
- func (c *CommandCtx) ValueOrElse(key string, defaultValue any) any
- func (c *CommandCtx) Values() map[string]any
- func (c *CommandCtx) Write(data []byte, contentType string, statusCode ...int) error
- type CommandHandler
- type Conn
- func (v *Conn) AddCommand(id, method string, tags []string, fn CommandHandler) error
- func (v *Conn) AllocResource(t AllocatableResourceType) any
- func (v *Conn) GetClientGrpcConn(t string) (*grpc.ClientConn, error)
- func (v *Conn) GetNexusGrpcConn() *grpc.ClientConn
- func (v *Conn) RegisterService() error
- func (v *Conn) RunCommands(addr string) error
- func (v *Conn) RunRegistering() error
- type WebSocketPackage
Constants ¶
View Source
const ( AllocatableResourceMq = AllocatableResourceType("mq") AllocatableResourceKv = AllocatableResourceType("kv") )
View Source
const ( ServiceTypeAuth = "id" ServiceTypePusher = "pusher" )
Variables ¶
This section is empty.
Functions ¶
func CtxValueMustBe ¶
func CtxValueMustBe[T any](c *CommandCtx, key string) (T, error)
func CtxValueShouldBe ¶
func CtxValueShouldBe[T any](c *CommandCtx, key string, defaultValue T) T
func GetCommandKey ¶
func GetOutboundIP ¶
Types ¶
type AllocatableResourceType ¶
type AllocatableResourceType = string
type CommandCtx ¶
type CommandCtx struct {
// contains filtered or unexported fields
}
func (*CommandCtx) Read ¶
func (c *CommandCtx) Read() []byte
func (*CommandCtx) ReadJSON ¶
func (c *CommandCtx) ReadJSON(out any) error
func (*CommandCtx) ValueOrElse ¶
func (c *CommandCtx) ValueOrElse(key string, defaultValue any) any
func (*CommandCtx) Values ¶
func (c *CommandCtx) Values() map[string]any
type CommandHandler ¶
type CommandHandler func(ctx *CommandCtx) error
type Conn ¶
type Conn struct { Addr string Info *proto.ServiceInfo // contains filtered or unexported fields }
func NewNexusConn ¶
func NewNexusConn(addr string, info *proto.ServiceInfo) (*Conn, error)
func (*Conn) AddCommand ¶
func (v *Conn) AddCommand(id, method string, tags []string, fn CommandHandler) error
func (*Conn) AllocResource ¶
func (v *Conn) AllocResource(t AllocatableResourceType) any
func (*Conn) GetClientGrpcConn ¶
func (v *Conn) GetClientGrpcConn(t string) (*grpc.ClientConn, error)
func (*Conn) GetNexusGrpcConn ¶
func (v *Conn) GetNexusGrpcConn() *grpc.ClientConn
func (*Conn) RegisterService ¶
func (*Conn) RunCommands ¶
func (*Conn) RunRegistering ¶
type WebSocketPackage ¶
type WebSocketPackage struct { Action string `json:"w"` Endpoint string `json:"e,omitempty"` Message string `json:"m,omitempty"` Payload any `json:"p"` }
func (WebSocketPackage) Marshal ¶
func (v WebSocketPackage) Marshal() []byte
func (WebSocketPackage) RawPayload ¶
func (v WebSocketPackage) RawPayload() []byte
Source Files ¶
Click to show internal directories.
Click to hide internal directories.