Documentation
¶
Overview ¶
Package exec holds the reduced public execution-context contract for Datly runtimes.
The stable core is the generic execution/observability payload:
- Context
- ContextKey
- WithContext / GetContext
- New(...) plus its generic options
Explicit HTTP construction and logging-preparation helpers may remain public for compatibility, but they are not the governing center of the package.
Index ¶
- Variables
- func WithContext(ctx context.Context, execCtx *Context) context.Context
- type Context
- func GetContext(ctx context.Context) *Context
- func New(options ...Option) *Context
- func NewContext(method string, URI string, header http.Header, version string) *Context
- func NewHTTPContext(method string, URI string, header http.Header, version string) *Context
- func PrepareLogging(ctx *Context, includeSQL bool) (*Context, *tracing.Trace)
- type Option
- func WithHeaders(header map[string]string) Option
- func WithMethod(method string) Option
- func WithStartTime(start time.Time) Option
- func WithStatus(status string) Option
- func WithStatusCode(code int) Option
- func WithTrace(trace *tracing.Trace) Option
- func WithTraceResource(serviceName, serviceVersion string) Option
- func WithURI(uri string) Option
Constants ¶
This section is empty.
Variables ¶
var ContextKey = contextKey("xdatly_exec_context")
Functions ¶
Types ¶
type Context ¶
type Context struct {
Method string `json:"method,omitempty"`
URI string `json:"uri,omitempty"`
StatusCode int `json:"statusCode,omitempty"`
Status string `json:"status,omitempty"`
Error string `json:"error,omitempty"`
ElapsedMs int `json:"elapsedMs,omitempty"`
StartTime time.Time `json:"startTime,omitempty"`
Header map[string]string `json:"header,omitempty"`
Metrics response.Metrics `json:"metrics,omitempty"`
TraceID string `json:"traceId,omitempty"`
Trace *tracing.Trace `json:"-"`
// contains filtered or unexported fields
}
func GetContext ¶
func New ¶
New creates a generic execution context without assuming any specific transport. Callers add transport/runtime details through options.
func NewContext ¶
NewContext is the compatibility wrapper over the older HTTP-colored constructor signature. Prefer New(...) for generic callers and NewHTTPContext(...) for explicit HTTP assembly.
func NewHTTPContext ¶
NewHTTPContext builds one execution context from HTTP request metadata. This helper is transport-specific; the stable generic entrypoint is New(...).
func PrepareLogging ¶
PrepareLogging is the compatibility helper that derives audit/trace-ready snapshots from one execution context. It is not the core execution-context contract itself; the stable core remains the Context payload plus its generic constructors and accessors.
func (*Context) AppendMetrics ¶
func (*Context) Complete ¶
Complete records the canonical invocation boundary. Existing native trace spans are completed; no default trace or span is created by this operation.
func (*Context) SnapshotForLogging ¶
type Option ¶
type Option func(*Context)
Option mutates the generic execution context shape.