Documentation
¶
Index ¶
- func ExtractDepNames(opts []InjectOption) []string
- func ExtractDeps(opts []InjectOption) []shared.Dep
- func GetHealthManager(c Container) (shared.HealthManager, error)
- func GetLogger(c Container) (logger.Logger, error)
- func GetMetrics(c Container) (metrics.Metrics, error)
- func Must[T any](c Container, name string) T
- func MustResolveReady[T any](ctx context.Context, c Container, name string) T
- func MustScope[T any](s Scope, name string) T
- func Provide[T any](c Container, name string, args ...any) error
- func ProvideWithOpts[T any](c Container, name string, opts []shared.RegisterOption, args ...any) error
- func RegisterInterface[I, T any](c Container, name string, factory func(Container) (T, error), ...) error
- func RegisterScoped[T any](c Container, name string, factory func(Container) (T, error)) error
- func RegisterScopedInterface[I, T any](c Container, name string, factory func(Container) (T, error)) error
- func RegisterScopedWith[T any](c Container, name string, args ...any) error
- func RegisterSingleton[T any](c Container, name string, factory func(Container) (T, error)) error
- func RegisterSingletonInterface[I, T any](c Container, name string, factory func(Container) (T, error)) error
- func RegisterSingletonWith[T any](c Container, name string, args ...any) error
- func RegisterTransient[T any](c Container, name string, factory func(Container) (T, error)) error
- func RegisterTransientInterface[I, T any](c Container, name string, factory func(Container) (T, error)) error
- func RegisterTransientWith[T any](c Container, name string, args ...any) error
- func RegisterValue[T any](c Container, name string, instance T) error
- func Resolve[T any](c Container, name string) (T, error)
- func ResolveReady[T any](ctx context.Context, c Container, name string) (T, error)
- func ResolveScope[T any](s Scope, name string) (T, error)
- func ResolveWithDeps(ctx context.Context, c Container, name string, deps []shared.Dep) error
- type Container
- type Context
- type ContextWithClean
- type Ctx
- func (c *Ctx) Bind(v any) error
- func (c *Ctx) BindJSON(v any) error
- func (c *Ctx) BindRequest(v any) error
- func (c *Ctx) BindXML(v any) error
- func (c *Ctx) Bytes(code int, data []byte) error
- func (c *Ctx) Cleanup()
- func (c *Ctx) Container() Container
- func (c *Ctx) Context() context.Context
- func (c *Ctx) Cookie(name string) (string, error)
- func (c *Ctx) DeleteCookie(name string)
- func (c *Ctx) DeleteSessionValue(key string)
- func (c *Ctx) DestroySession() error
- func (c *Ctx) Flush() error
- func (c *Ctx) FormFile(name string) (multipart.File, *multipart.FileHeader, error)
- func (c *Ctx) FormFiles(name string) ([]*multipart.FileHeader, error)
- func (c *Ctx) FormValue(name string) string
- func (c *Ctx) FormValues(name string) []string
- func (c *Ctx) Get(key string) any
- func (c *Ctx) GetAllCookies() map[string]string
- func (c *Ctx) GetSessionValue(key string) (any, bool)
- func (c *Ctx) HasCookie(name string) bool
- func (c *Ctx) Header(key string) string
- func (c *Ctx) HealthManager() HealthManager
- func (c *Ctx) JSON(code int, v any) error
- func (c *Ctx) Metrics() Metrics
- func (c *Ctx) Must(name string) any
- func (c *Ctx) MustGet(key string) any
- func (c *Ctx) NoContent(code int) error
- func (c *Ctx) Param(name string) string
- func (c *Ctx) ParamBool(name string) (bool, error)
- func (c *Ctx) ParamBoolDefault(name string, defaultValue bool) bool
- func (c *Ctx) ParamFloat64(name string) (float64, error)
- func (c *Ctx) ParamFloat64Default(name string, defaultValue float64) float64
- func (c *Ctx) ParamInt(name string) (int, error)
- func (c *Ctx) ParamInt64(name string) (int64, error)
- func (c *Ctx) ParamInt64Default(name string, defaultValue int64) int64
- func (c *Ctx) ParamIntDefault(name string, defaultValue int) int
- func (c *Ctx) Params() map[string]string
- func (c *Ctx) ParseMultipartForm(maxMemory int64) error
- func (c *Ctx) Query(name string) string
- func (c *Ctx) QueryDefault(name, defaultValue string) string
- func (c *Ctx) Redirect(code int, url string) error
- func (c *Ctx) Request() *http.Request
- func (c *Ctx) Resolve(name string) (any, error)
- func (c *Ctx) Response() http.ResponseWriter
- func (c *Ctx) SaveSession() error
- func (c *Ctx) Scope() Scope
- func (c *Ctx) Session() (shared.Session, error)
- func (c *Ctx) SessionID() string
- func (c *Ctx) Set(key string, value any)
- func (c *Ctx) SetCookie(name, value string, maxAge int)
- func (c *Ctx) SetCookieWithOptions(name, value string, path, domain string, maxAge int, secure, httpOnly bool)
- func (c *Ctx) SetHeader(key, value string)
- func (c *Ctx) SetSession(session shared.Session)
- func (c *Ctx) SetSessionValue(key string, value any)
- func (c *Ctx) Status(code int) shared.ResponseBuilder
- func (c *Ctx) String(code int, s string) error
- func (c *Ctx) WithContext(ctx context.Context)
- func (c *Ctx) WriteSSE(event string, data any) error
- func (c *Ctx) XML(code int, v any) error
- type DependencyGraph
- func (g *DependencyGraph) AddNode(name string, dependencies []string)
- func (g *DependencyGraph) AddNodeWithDeps(name string, deps []shared.Dep)
- func (g *DependencyGraph) GetDependencies(name string) []string
- func (g *DependencyGraph) GetDeps(name string) []shared.Dep
- func (g *DependencyGraph) GetEagerDependencies(name string) []string
- func (g *DependencyGraph) HasNode(name string) bool
- func (g *DependencyGraph) TopologicalSort() ([]string, error)
- func (g *DependencyGraph) TopologicalSortEagerOnly() ([]string, error)
- type Factory
- type HealthManager
- type InjectOption
- type Lazy
- type LazyAny
- type Metrics
- type OptionalLazy
- type OptionalLazyAny
- type Provider
- type RegisterOption
- type ResponseBuilder
- func (rb *ResponseBuilder) Bytes(data []byte) error
- func (rb *ResponseBuilder) Header(key, value string) shared.ResponseBuilder
- func (rb *ResponseBuilder) JSON(v any) error
- func (rb *ResponseBuilder) NoContent() error
- func (rb *ResponseBuilder) String(s string) error
- func (rb *ResponseBuilder) XML(v any) error
- type Scope
- type ServiceInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractDepNames ¶ added in v0.8.0
func ExtractDepNames(opts []InjectOption) []string
ExtractDepNames extracts just the names from inject options.
func ExtractDeps ¶ added in v0.8.0
func ExtractDeps(opts []InjectOption) []shared.Dep
ExtractDeps extracts dependency specifications from inject options.
func GetHealthManager ¶ added in v0.5.0
func GetHealthManager(c Container) (shared.HealthManager, error)
GetHealthManager resolves the health manager from the container This is a convenience function for resolving the health manager service The health manager type is defined in the forge package, so this returns the interface.
func GetLogger ¶ added in v0.5.0
GetLogger resolves the logger from the container This is a convenience function for resolving the logger service The logger type is defined in the forge package, so this returns interface{} and should be type-asserted to the appropriate logger interface.
func GetMetrics ¶ added in v0.5.0
GetMetrics resolves the metrics from the container This is a convenience function for resolving the metrics service The metrics type is defined in the forge package, so this returns interface{} and should be type-asserted to the appropriate metrics interface.
func MustResolveReady ¶ added in v0.8.0
MustResolveReady resolves or panics, ensuring the service is started first. Use only during startup/registration phase.
func Provide ¶ added in v0.8.0
Provide registers a service with typed dependency injection. It accepts InjectOption arguments followed by a factory function.
The factory function receives the resolved dependencies in order and returns the service instance and an optional error.
Usage:
di.Provide[*UserService](c, "userService",
di.Inject[*bun.DB]("database"),
di.Inject[Logger]("logger"),
di.LazyInject[*Cache]("cache"),
func(db *bun.DB, logger Logger, cache *Lazy[*Cache]) (*UserService, error) {
return &UserService{db, logger, cache}, nil
},
)
func ProvideWithOpts ¶ added in v0.8.0
func ProvideWithOpts[T any](c Container, name string, opts []shared.RegisterOption, args ...any) error
ProvideWithOpts is like Provide but accepts additional RegisterOptions.
func RegisterInterface ¶
func RegisterInterface[I, T any](c Container, name string, factory func(Container) (T, error), opts ...RegisterOption) error
RegisterInterface registers an implementation as an interface Supports all lifecycle options (Singleton, Scoped, Transient).
func RegisterScoped ¶
RegisterScoped is a convenience wrapper for request-scoped services.
func RegisterScopedInterface ¶
func RegisterScopedInterface[I, T any](c Container, name string, factory func(Container) (T, error)) error
RegisterScopedInterface is a convenience wrapper.
func RegisterScopedWith ¶ added in v0.8.0
RegisterScopedWith registers a scoped service with typed dependency injection. Accepts InjectOption arguments followed by a factory function.
Usage:
di.RegisterScopedWith[*Session](c, "session",
di.Inject[*User]("user"),
func(user *User) (*Session, error) {
return &Session{user: user}, nil
},
)
func RegisterSingleton ¶
RegisterSingleton is a convenience wrapper for singleton services.
func RegisterSingletonInterface ¶
func RegisterSingletonInterface[I, T any](c Container, name string, factory func(Container) (T, error)) error
RegisterSingletonInterface is a convenience wrapper.
func RegisterSingletonWith ¶ added in v0.8.0
RegisterSingletonWith registers a singleton service with typed dependency injection. Accepts InjectOption arguments followed by a factory function.
Usage:
di.RegisterSingletonWith[*UserService](c, "userService",
di.Inject[*bun.DB]("database"),
func(db *bun.DB) (*UserService, error) {
return &UserService{db: db}, nil
},
)
func RegisterTransient ¶
RegisterTransient is a convenience wrapper for transient services.
func RegisterTransientInterface ¶
func RegisterTransientInterface[I, T any](c Container, name string, factory func(Container) (T, error)) error
RegisterTransientInterface is a convenience wrapper.
func RegisterTransientWith ¶ added in v0.8.0
RegisterTransientWith registers a transient service with typed dependency injection. Accepts InjectOption arguments followed by a factory function.
Usage:
di.RegisterTransientWith[*Request](c, "request",
di.Inject[*Context]("ctx"),
func(ctx *Context) (*Request, error) {
return &Request{ctx: ctx}, nil
},
)
func RegisterValue ¶
RegisterValue registers a pre-built instance (always singleton).
func ResolveReady ¶ added in v0.8.0
ResolveReady resolves a service with type safety, ensuring it and its dependencies are started first. This is useful during extension Register() phase when you need a dependency to be fully initialized before use.
func ResolveScope ¶
ResolveScope is a helper for resolving from a scope.
Types ¶
type Context ¶
Context wraps http.Request with convenience methods.
func NewContext ¶
NewContext creates a new context.
type ContextWithClean ¶
type ContextWithClean interface {
Cleanup()
}
type Ctx ¶
type Ctx struct {
// contains filtered or unexported fields
}
Ctx implements Context interface.
func (*Ctx) BindRequest ¶ added in v0.5.0
BindRequest binds and validates request data from all sources (path, query, header, body). This method provides comprehensive request binding that:
- Binds path parameters from URL path segments (path:"name")
- Binds query parameters from URL query string (query:"name")
- Binds headers from HTTP headers (header:"name")
- Binds body fields from request body (json:"name" or body:"")
- Validates all fields using validation tags (required, minLength, etc.)
Example:
type CreateUserRequest struct {
TenantID string `path:"tenantId" description:"Tenant ID"`
DryRun bool `query:"dryRun" default:"false"`
APIKey string `header:"X-API-Key" required:"true"`
Name string `json:"name" minLength:"1" maxLength:"100"`
}
func handler(ctx forge.Context) error {
var req CreateUserRequest
if err := ctx.BindRequest(&req); err != nil {
return err // Returns ValidationErrors if validation fails
}
// All fields are now bound and validated
}
func (*Ctx) Cleanup ¶
func (c *Ctx) Cleanup()
Cleanup ends the scope (should be called after request).
func (*Ctx) DeleteCookie ¶ added in v0.4.0
DeleteCookie deletes a cookie by setting MaxAge to -1.
func (*Ctx) DeleteSessionValue ¶ added in v0.4.0
DeleteSessionValue deletes a value from the current session.
func (*Ctx) DestroySession ¶ added in v0.4.0
DestroySession removes the current session from the store.
func (*Ctx) Flush ¶ added in v0.7.0
Flush flushes any buffered response data to the client. Returns an error if the response writer doesn't support flushing.
func (*Ctx) FormFiles ¶
func (c *Ctx) FormFiles(name string) ([]*multipart.FileHeader, error)
FormFiles retrieves multiple files with the same field name from a multipart form.
func (*Ctx) FormValues ¶
FormValues retrieves all values for a form field.
func (*Ctx) GetAllCookies ¶ added in v0.4.0
GetAllCookies returns all cookies as a map.
func (*Ctx) GetSessionValue ¶ added in v0.4.0
GetSessionValue gets a value from the current session.
func (*Ctx) HealthManager ¶
func (c *Ctx) HealthManager() HealthManager
HealthManager returns the health manager.
func (*Ctx) JSON ¶
JSON sends JSON response. If v is a struct with header:"..." tags, those headers are set automatically. If v has a field with body:"" tag, that field's value is serialized instead of the whole struct. If the route has sensitive field cleaning enabled, fields with sensitive:"..." tags are processed.
func (*Ctx) ParamBoolDefault ¶ added in v0.4.0
ParamBoolDefault returns a path parameter as bool with default value.
func (*Ctx) ParamFloat64 ¶ added in v0.4.0
ParamFloat64 returns a path parameter as float64.
func (*Ctx) ParamFloat64Default ¶ added in v0.4.0
ParamFloat64Default returns a path parameter as float64 with default value.
func (*Ctx) ParamInt64 ¶ added in v0.4.0
ParamInt64 returns a path parameter as int64.
func (*Ctx) ParamInt64Default ¶ added in v0.4.0
ParamInt64Default returns a path parameter as int64 with default value.
func (*Ctx) ParamIntDefault ¶ added in v0.4.0
ParamIntDefault returns a path parameter as int with default value.
func (*Ctx) ParseMultipartForm ¶
ParseMultipartForm parses a multipart form with the specified max memory maxMemory: maximum memory in bytes to use for storing files in memory (rest goes to disk) Recommended values: 10MB (10<<20), 32MB (32<<20), 64MB (64<<20).
func (*Ctx) QueryDefault ¶
QueryDefault returns a query parameter with default value.
func (*Ctx) Response ¶
func (c *Ctx) Response() http.ResponseWriter
Response returns the HTTP response writer.
func (*Ctx) SaveSession ¶ added in v0.4.0
SaveSession saves the current session to the session store.
func (*Ctx) SetCookieWithOptions ¶ added in v0.4.0
func (c *Ctx) SetCookieWithOptions(name, value string, path, domain string, maxAge int, secure, httpOnly bool)
SetCookieWithOptions sets a cookie with full control over options.
func (*Ctx) SetSession ¶ added in v0.4.0
SetSession sets the current session in the context.
func (*Ctx) SetSessionValue ¶ added in v0.4.0
SetSessionValue sets a value in the current session.
func (*Ctx) Status ¶
func (c *Ctx) Status(code int) shared.ResponseBuilder
Status sets the HTTP status code and returns a builder for chaining.
func (*Ctx) WithContext ¶
WithContext replaces the request context.
type DependencyGraph ¶
type DependencyGraph struct {
// contains filtered or unexported fields
}
DependencyGraph manages service dependencies.
func NewDependencyGraph ¶
func NewDependencyGraph() *DependencyGraph
NewDependencyGraph creates a new dependency graph.
func (*DependencyGraph) AddNode ¶
func (g *DependencyGraph) AddNode(name string, dependencies []string)
AddNode adds a node with its dependencies (string-based, backward compatible). Nodes are processed in the order they are added (FIFO) when no dependencies exist.
func (*DependencyGraph) AddNodeWithDeps ¶ added in v0.8.0
func (g *DependencyGraph) AddNodeWithDeps(name string, deps []shared.Dep)
AddNodeWithDeps adds a node with full Dep specs. This is the new API that supports lazy/optional dependencies.
func (*DependencyGraph) GetDependencies ¶ added in v0.8.0
func (g *DependencyGraph) GetDependencies(name string) []string
GetDependencies returns the dependency names for a node.
func (*DependencyGraph) GetDeps ¶ added in v0.8.0
func (g *DependencyGraph) GetDeps(name string) []shared.Dep
GetDeps returns the full Dep specs for a node.
func (*DependencyGraph) GetEagerDependencies ¶ added in v0.8.0
func (g *DependencyGraph) GetEagerDependencies(name string) []string
GetEagerDependencies returns only the eager (non-lazy) dependencies. These are the ones that must be resolved before the service can be created.
func (*DependencyGraph) HasNode ¶ added in v0.8.0
func (g *DependencyGraph) HasNode(name string) bool
HasNode checks if a node exists in the graph.
func (*DependencyGraph) TopologicalSort ¶
func (g *DependencyGraph) TopologicalSort() ([]string, error)
TopologicalSort returns nodes in dependency order. Nodes without dependencies maintain their registration order (FIFO). Returns error if circular dependency detected.
func (*DependencyGraph) TopologicalSortEagerOnly ¶ added in v0.8.0
func (g *DependencyGraph) TopologicalSortEagerOnly() ([]string, error)
TopologicalSortEagerOnly returns nodes sorted considering only eager dependencies. Lazy dependencies are excluded from the ordering since they're resolved on-demand.
type HealthManager ¶
type HealthManager = shared.HealthManager
type InjectOption ¶ added in v0.8.0
InjectOption represents a dependency injection option. It carries type information and the dependency specification.
func Inject ¶ added in v0.8.0
func Inject[T any](name string) InjectOption
Inject creates an eager injection option for a dependency. The dependency is resolved immediately when the service is created.
Usage:
forge.Provide(c, "userService",
forge.Inject[*bun.DB]("database"),
func(db *bun.DB) (*UserService, error) { ... },
)
func LazyInject ¶ added in v0.8.0
func LazyInject[T any](name string) InjectOption
LazyInject creates a lazy injection option for a dependency. The dependency is resolved on first access via Lazy[T].Get().
Usage:
forge.Provide(c, "userService",
forge.LazyInject[*Cache]("cache"),
func(cache *forge.Lazy[*Cache]) (*UserService, error) { ... },
)
func LazyOptionalInject ¶ added in v0.8.0
func LazyOptionalInject[T any](name string) InjectOption
LazyOptionalInject creates a lazy optional injection option. The dependency is resolved on first access and returns nil if not found.
Usage:
forge.Provide(c, "userService",
forge.LazyOptionalInject[*Analytics]("analytics"),
func(analytics *forge.OptionalLazy[*Analytics]) (*UserService, error) { ... },
)
func OptionalInject ¶ added in v0.8.0
func OptionalInject[T any](name string) InjectOption
OptionalInject creates an optional injection option for a dependency. The dependency is resolved immediately but returns nil if not found.
Usage:
forge.Provide(c, "userService",
forge.OptionalInject[*Tracer]("tracer"),
func(tracer *Tracer) (*UserService, error) { ... },
)
func ProviderInject ¶ added in v0.8.0
func ProviderInject[T any](name string) InjectOption
ProviderInject creates an injection option for a transient dependency provider. Each call to Provider[T].Provide() creates a new instance.
Usage:
forge.Provide(c, "handler",
forge.ProviderInject[*Request]("request"),
func(reqProvider *forge.Provider[*Request]) (*Handler, error) { ... },
)
type Lazy ¶ added in v0.8.0
type Lazy[T any] struct { // contains filtered or unexported fields }
Lazy wraps a dependency that is resolved on first access. This is useful for breaking circular dependencies or deferring resolution of expensive services until they're actually needed.
func (*Lazy[T]) Get ¶ added in v0.8.0
Get resolves the dependency and returns it. The resolution happens only once; subsequent calls return the cached value.
func (*Lazy[T]) IsResolved ¶ added in v0.8.0
IsResolved returns true if the dependency has been resolved.
type LazyAny ¶ added in v0.8.0
type LazyAny struct {
// contains filtered or unexported fields
}
LazyAny is a non-generic lazy wrapper that can hold any type. This is needed because we can't create Lazy[T] dynamically at runtime.
func NewLazyAny ¶ added in v0.8.0
NewLazyAny creates a new lazy wrapper for any type.
func (*LazyAny) IsResolved ¶ added in v0.8.0
IsResolved returns true if the dependency has been resolved.
type OptionalLazy ¶ added in v0.8.0
type OptionalLazy[T any] struct { // contains filtered or unexported fields }
OptionalLazy wraps an optional dependency that is resolved on first access. Returns nil without error if the dependency is not found.
func NewOptionalLazy ¶ added in v0.8.0
func NewOptionalLazy[T any](container shared.Container, name string) *OptionalLazy[T]
NewOptionalLazy creates a new optional lazy dependency wrapper.
func (*OptionalLazy[T]) Get ¶ added in v0.8.0
func (l *OptionalLazy[T]) Get() (T, error)
Get resolves the dependency and returns it. Returns the zero value without error if the dependency is not found.
func (*OptionalLazy[T]) IsFound ¶ added in v0.8.0
func (l *OptionalLazy[T]) IsFound() bool
IsFound returns true if the dependency was found (only valid after resolution).
func (*OptionalLazy[T]) IsResolved ¶ added in v0.8.0
func (l *OptionalLazy[T]) IsResolved() bool
IsResolved returns true if the dependency has been resolved.
func (*OptionalLazy[T]) MustGet ¶ added in v0.8.0
func (l *OptionalLazy[T]) MustGet() T
MustGet resolves the dependency and returns it, panicking on error. Returns the zero value if the dependency is not found (does not panic).
func (*OptionalLazy[T]) Name ¶ added in v0.8.0
func (l *OptionalLazy[T]) Name() string
Name returns the name of the dependency.
type OptionalLazyAny ¶ added in v0.8.0
type OptionalLazyAny struct {
// contains filtered or unexported fields
}
OptionalLazyAny is a non-generic optional lazy wrapper.
func NewOptionalLazyAny ¶ added in v0.8.0
func NewOptionalLazyAny(c Container, name string, expectedType reflect.Type) *OptionalLazyAny
NewOptionalLazyAny creates a new optional lazy wrapper.
func (*OptionalLazyAny) Get ¶ added in v0.8.0
func (l *OptionalLazyAny) Get() (any, error)
Get resolves the dependency and returns it.
func (*OptionalLazyAny) IsFound ¶ added in v0.8.0
func (l *OptionalLazyAny) IsFound() bool
IsFound returns true if the dependency was found.
func (*OptionalLazyAny) IsResolved ¶ added in v0.8.0
func (l *OptionalLazyAny) IsResolved() bool
IsResolved returns true if the dependency has been resolved.
func (*OptionalLazyAny) MustGet ¶ added in v0.8.0
func (l *OptionalLazyAny) MustGet() any
MustGet resolves the dependency and returns it, panicking on error.
func (*OptionalLazyAny) Name ¶ added in v0.8.0
func (l *OptionalLazyAny) Name() string
Name returns the name of the dependency.
type Provider ¶ added in v0.8.0
type Provider[T any] struct { // contains filtered or unexported fields }
Provider wraps a dependency that creates new instances on each access. This is useful for transient dependencies where a fresh instance is needed each time.
func NewProvider ¶ added in v0.8.0
NewProvider creates a new provider for transient dependencies.
func (*Provider[T]) MustProvide ¶ added in v0.8.0
func (p *Provider[T]) MustProvide() T
MustProvide resolves and returns a new instance, panicking on error.
type RegisterOption ¶
type RegisterOption = shared.RegisterOption
RegisterOption is a configuration option for service registration.
func Scoped ¶
func Scoped() RegisterOption
Scoped makes the service live for the duration of a scope.
func Transient ¶
func Transient() RegisterOption
Transient makes the service created on each resolve.
func WithDIMetadata ¶
func WithDIMetadata(key, value string) RegisterOption
WithDIMetadata adds diagnostic metadata to DI service registration.
func WithDependencies ¶
func WithDependencies(deps ...string) RegisterOption
WithDependencies declares explicit dependencies.
func WithGroup ¶
func WithGroup(group string) RegisterOption
WithGroup adds service to a named group.
type ResponseBuilder ¶
type ResponseBuilder struct {
// contains filtered or unexported fields
}
ResponseBuilder provides fluent response building.
func (*ResponseBuilder) Bytes ¶
func (rb *ResponseBuilder) Bytes(data []byte) error
Bytes sends a byte response with the configured status.
func (*ResponseBuilder) Header ¶
func (rb *ResponseBuilder) Header(key, value string) shared.ResponseBuilder
Header sets a response header and returns the builder for chaining.
func (*ResponseBuilder) JSON ¶
func (rb *ResponseBuilder) JSON(v any) error
JSON sends a JSON response with the configured status.
func (*ResponseBuilder) NoContent ¶
func (rb *ResponseBuilder) NoContent() error
NoContent sends a no-content response with the configured status.
func (*ResponseBuilder) String ¶
func (rb *ResponseBuilder) String(s string) error
String sends a string response with the configured status.
func (*ResponseBuilder) XML ¶
func (rb *ResponseBuilder) XML(v any) error
XML sends an XML response with the configured status.
type Scope ¶
Scope represents a lifetime scope for scoped services Typically used for HTTP requests or other bounded operations.
type ServiceInfo ¶
type ServiceInfo = shared.ServiceInfo
ServiceInfo contains diagnostic information.