runtimecontext

package
v1.0.63 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 3, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package runtimecontext supplies an optional, process-scoped request context.

Index

Constants

View Source
const (
	HeaderName     = requestmeta.DingTalkExtHeader
	PayloadVersion = runtimepayload.PayloadVersion
	Environment    = "online"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Result

type Result struct {
	State          State         `json:"state"`
	PayloadVersion string        `json:"payload_version"`
	Environment    string        `json:"environment"`
	Elapsed        time.Duration `json:"-"`
	ErrorCategory  string        `json:"error_category,omitempty"`
	// contains filtered or unexported fields
}

Result is the immutable process result. Sensitive values stay private and cannot be serialized or formatted accidentally.

func ReadyResultForTest

func ReadyResultForTest(value string) Result

ReadyResultForTest constructs a ready result for cross-package tests. Production code must obtain Result values from Resolve.

func Resolve

func Resolve() Result

Resolve initializes and returns the process-scoped context. It never retries: every caller observes the same immutable outcome.

func (Result) AttachToURL

func (r Result) AttachToURL(rawURL string) (string, bool)

AttachToURL attaches the private runtime value to a login authorization URL. The URL may be opened in a browser or shown as a manual login link. Callers must never send it to diagnostic logs or persist it as application state.

func (Result) DiagnosticDetail

func (r Result) DiagnosticDetail() map[string]any

DiagnosticDetail returns redacted, stable diagnostic fields.

func (Result) GoString

func (r Result) GoString() string

func (Result) HeaderValue

func (r Result) HeaderValue() (string, bool)

HeaderValue returns the compact request header payload when initialization completed successfully.

func (Result) String

func (r Result) String() string

type State

type State string
const (
	StateReady       State = "ready"
	StateUnavailable State = "unavailable"
	StateTimeout     State = "timeout"
	StateError       State = "error"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL