Documentation
¶
Index ¶
- Variables
- func GenerateSpanID() string
- func GenerateTraceID() string
- type APIContext
- type AsmParam
- type ContextKey
- type DalContext
- type Debugger
- type EndpointMetas
- type Handler
- type HandlerFunc
- type ParsedName
- type PreparedQuery
- type QueryResult
- type RequestContext
- type RequestReader
- type RequestWriter
- type ResponseReader
- type ResponseWriter
- type RunnerContext
Constants ¶
This section is empty.
Variables ¶
View Source
var ApiCtxKey = ContextKey{}
Functions ¶
func GenerateSpanID ¶ added in v0.1.18
func GenerateSpanID() string
GenerateSpanID generates a 64-bit Span ID
func GenerateTraceID ¶ added in v0.1.18
func GenerateTraceID() string
GenerateTraceID generates a 128-bit Trace ID
Types ¶
type APIContext ¶ added in v0.1.0
type APIContext interface {
RequestReader
ResponseReader
RequestWriter
ResponseWriter
Debugger
}
APIContext combines request and response contexts
type ContextKey ¶ added in v0.1.1
type ContextKey struct{}
type DalContext ¶ added in v0.1.9
type DalContext struct {
// Container for transaction management.
// Ensures that accessing the same database during a single API request uses the same connection,
// and automatically commits or rolls back transactions when the request ends.
Container *sync.Map
TraceID string
ParentID string
SpanID string
DebugInfo []map[string]any
}
type EndpointMetas ¶ added in v0.1.22
type Handler ¶ added in v0.1.3
type Handler interface {
Process(APIContext) error
}
type HandlerFunc ¶ added in v0.1.3
type HandlerFunc func(APIContext) error
func (HandlerFunc) Process ¶ added in v0.1.13
func (hf HandlerFunc) Process(ctx APIContext) error
type ParsedName ¶ added in v0.3.0
type ParsedName struct {
FullName string `json:"fullName"` // FullName = EndpointName + ApiName
EndpointName string `json:"endpointName"`
ApiName string `json:"apiName"` // ApiName = EntityName + EntityMethod
EntityName string `json:"entityName"`
EntityMethod string `json:"entityMethod"`
}
func ParseMethodName ¶ added in v0.3.0
func ParseMethodName(method string) (*ParsedName, error)
type PreparedQuery ¶
type PreparedQuery struct {
Query string `json:"query"`
Bind []any `json:"bind"`
QueryType string `json:"queryType"`
CheckPoint []*PreparedQuery `json:"checkPoint"`
DatabaseUpdater []*PreparedQuery `json:"databaseUpdater"`
ResultEnricher []*PreparedQuery `json:"resultEnricher"`
}
type QueryResult ¶
type RequestContext ¶ added in v0.1.0
type RequestReader ¶ added in v0.1.15
type RequestReader interface {
RequestID() string
RequestContext() *RequestContext
Method() string
Params() any
RawParams() []byte
Metas() map[string]any
EndpointMetas() *EndpointMetas
}
RequestReader contains request-related information
type RequestWriter ¶ added in v0.1.15
type RequestWriter interface {
SetRequestID(string)
SetMethod(string)
SetParams(any)
SetRawParams([]byte)
SetMetas(map[string]any)
SetEndpointMetas(*EndpointMetas)
}
RequestWriter allows modification of request-related information
type ResponseReader ¶ added in v0.1.15
ResponseReader contains response-related information
type ResponseWriter ¶ added in v0.1.15
ResponseWriter allows modification of response-related information
type RunnerContext ¶ added in v0.3.0
type RunnerContext struct {
// Provide the default entity name for getting database connections
// only when the scripting language is native SQL.
DefaultEntityName string
GlobalThis map[string]any
DalCtx *DalContext
}
Click to show internal directories.
Click to hide internal directories.