Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Auth ¶ added in v1.5.6
type Auth interface {
// Authenticate attempts to identify and return the user associated with
// an incoming HTTP request, typically by inspecting headers or tokens.
Authenticate(*http.Request) (*authschema.User, error)
// Authorize checks if a given user has the necessary permissions (scopes)
// to perform an action.
Authorize(context.Context, *authschema.User, ...string) error
}
Auth defines methods for authenticating users based on HTTP requests and authorizing them based on required scopes.
type Cmd ¶ added in v1.5.6
type Cmd interface {
// Run the command
Run() error
// Return the context
Context() context.Context
// Return the debug mode
GetDebug() DebugLevel
// Return the endpoint
GetEndpoint(paths ...string) *url.URL
// Return the HTTP client options
GetClientOpts() []client.ClientOpt
}
Cmd represents the command line interface context
type HTTPMiddleware ¶ added in v1.5.0
type HTTPMiddleware interface {
// Return a http handler with middleware as the parent handler
HandleFunc(http.HandlerFunc) http.HandlerFunc
}
type HTTPRouter ¶ added in v1.5.0
type Logger ¶
type Logger interface {
HTTPMiddleware
// Debug logs a debugging message.
Debug(context.Context, ...any)
// Debugf logs a formatted debugging message.
Debugf(context.Context, string, ...any)
// Print logs an informational message.
Print(context.Context, ...any)
// Printf logs a formatted informational message.
Printf(context.Context, string, ...any)
// With returns a new Logger that includes the given key-value pairs
// in its structured log output.
With(...any) Logger
}
Logger defines methods for logging messages and structured data. It can also act as HTTP middleware for request logging.
type PGCallback ¶ added in v1.5.5
PGCallback defines the function signature for handling tasks dequeued from a PostgreSQL-backed queue.
type PGQueue ¶ added in v1.5.5
type PGQueue interface {
// Conn returns the underlying connection pool object.
Conn() pg.PoolConn
// RegisterTicker registers a periodic task (ticker) with a callback function.
// It returns the metadata of the registered ticker.
RegisterTicker(context.Context, pgschema.TickerMeta, PGCallback) (*pgschema.Ticker, error)
// RegisterQueue registers a task queue with a callback function.
// It returns the metadata of the registered queue.
RegisterQueue(context.Context, pgschema.QueueMeta, PGCallback) (*pgschema.Queue, error)
// CreateTask adds a new task to a specified queue with a payload and optional delay.
// It returns the metadata of the created task.
CreateTask(context.Context, string, any, time.Duration) (*pgschema.Task, error)
// UnmarshalPayload unmarshals a payload into a destination object.
UnmarshalPayload(dest any, payload any) error
}
PGQueue defines methods for interacting with a PostgreSQL-backed task queue.
type Plugin ¶
type Plugin interface {
// Return the unique name for the plugin
Name() string
// Return a description of the plugin
Description() string
// Create a task from a plugin
New(context.Context) (Task, error)
}
Plugin represents a service
type PluginResolverFunc ¶ added in v1.5.7
Define a function for resolving plugin configuration
type Provider ¶
type Provider interface {
Task
// Write out the plugin configuration to a writer
WriteConfig(io.Writer) error
// Load a plugin by name and label, and provide a resolver function
Load(string, string, PluginResolverFunc) error
// Return a task given a plugin label
Task(context.Context, string) Task
}
Provider represents a service provider
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
server
command
|
|
|
npm
|
|
|
pkg
|
|
|
plugin
|
|
|
auth
command
|
|
|
cert
command
|
|
|
helloworld
command
|
|
|
httprouter
command
|
|
|
httpserver
command
|
|
|
log
command
|
|
|
pg
command
|
|
|
pgqueue
command
|
|
|
pgqueue/old
command
|
Click to show internal directories.
Click to hide internal directories.