Documentation
¶
Index ¶
- Constants
- type Client
- type ClientOption
- type ClientOptions
- type DefaultTool
- func (d *DefaultTool) AttachServer(ctx context.Context, s contract.ServerOperator) error
- func (d *DefaultTool) Mount(ctx context.Context, r []*contract.Route) error
- func (d *DefaultTool) ParsePath(ctx context.Context, r *http.Request, re *regexp.Regexp) (map[string]string, error)
- func (d *DefaultTool) ParseQuery(ctx context.Context, r *http.Request) (map[string][]string, error)
- func (d *DefaultTool) RKey(ctx context.Context) (string, error)
- func (d *DefaultTool) Run(ctx context.Context) error
- func (d *DefaultTool) Stop(ctx context.Context) error
- func (d *DefaultTool) SvcKey(ctx context.Context) (string, error)
- func (d *DefaultTool) Vars(ctx context.Context) (*config.Vars, error)
- type Dependencies
- type Pattern
- type Tool
Constants ¶
View Source
const ( // PatID matches numeric path parameters (e.g., user ID). PatID Pattern = `[0-9]+` // PatName matches alphabetic characters only (uppercase or lowercase). PatName Pattern = `[a-zA-Z]+` // PatWord matches any word-like token (alphanumeric and underscore). PatWord Pattern = `\w+` // PatWordCI matches word-like tokens, case-insensitive. PatWordCI Pattern = `(?i)\w+` // PatEmail matches a basic email address format. PatEmail Pattern = `[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}` // PatOID matches a 24-character hexadecimal string (MongoDB ObjectID). PatOID Pattern = `[0-9a-fA-F]{24}` // PatFile matches any file name with an extension. PatFile Pattern = `.*\.[^/]*$` // PatUUID matches a UUID string in standard 8-4-4-4-12 format. PatUUID Pattern = `[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}` // PKey is the default key for path parameters. PKey = "_p" // RKey is the default ressource key. RKey = "_r" // SvcKey is the default service key. SvcKey = "_s" // PathActions is the default path for actions. PathActions = "actions" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface {
contract.RouterOperator
}
func NewClient ¶
func NewClient(d Dependencies, opts ClientOptions) (Client, error)
type ClientOption ¶
type ClientOption func(*ClientOptions)
func WithDashboard ¶ added in v0.1.11
func WithDashboard() ClientOption
func WithPathKey ¶
func WithPathKey(x string) ClientOption
func WithRessourceKey ¶
func WithRessourceKey(x string) ClientOption
func WithSvcKey ¶ added in v0.1.198
func WithSvcKey(x string) ClientOption
type ClientOptions ¶
func ApplyClientOptions ¶
func ApplyClientOptions(opts *ClientOptions, modifiers ...ClientOption) ClientOptions
type DefaultTool ¶ added in v0.1.11
func NewTool ¶
func NewTool(c Client, opts contract.ToolOptions[Client]) *DefaultTool
func (*DefaultTool) AttachServer ¶ added in v0.1.26
func (d *DefaultTool) AttachServer(ctx context.Context, s contract.ServerOperator) error
AttachServer attaches the server operator to the router.
func (*DefaultTool) ParsePath ¶ added in v0.1.27
func (d *DefaultTool) ParsePath(ctx context.Context, r *http.Request, re *regexp.Regexp) (map[string]string, error)
ParsePath extracts path parameters using the route regex.
func (*DefaultTool) ParseQuery ¶ added in v0.1.27
ParseQuery returns query parameters from the request.
func (*DefaultTool) RKey ¶ added in v0.1.198
func (d *DefaultTool) RKey(ctx context.Context) (string, error)
RKey returns the ressource key configured for the router.
func (*DefaultTool) Run ¶ added in v0.1.11
func (d *DefaultTool) Run(ctx context.Context) error
Run starts the router server.
func (*DefaultTool) Stop ¶ added in v0.1.11
func (d *DefaultTool) Stop(ctx context.Context) error
Stop gracefully shuts down the router server.
type Dependencies ¶
type Dependencies struct {
RM *contract.RegistryMutex
R contract.Registry
L contract.LimiterOperator
SM contract.SemaphoreOperator
S contract.ServerOperator
}
Click to show internal directories.
Click to hide internal directories.