Documentation
¶
Index ¶
- func DoTrace(ctx context.Context, a *Actor, scope TraceScope, fn func(*sql.DB) error) error
- func DoValue[T any](ctx context.Context, a *Actor, fn func(*sql.DB) (T, error)) (T, error)
- func DoValueTrace[T any](ctx context.Context, a *Actor, scope TraceScope, fn func(*sql.DB) (T, error)) (T, error)
- func SetTraceSink(sink TraceSink)
- func TxTrace(ctx context.Context, a *Actor, scope TraceScope, fn func(*sql.Tx) error) error
- func TxValue[T any](ctx context.Context, a *Actor, fn func(*sql.Tx) (T, error)) (T, error)
- func TxValueTrace[T any](ctx context.Context, a *Actor, scope TraceScope, fn func(*sql.Tx) (T, error)) (T, error)
- func WithTraceScope(scope TraceScope, fn func())
- type Actor
- type Opened
- type TraceEvent
- type TraceScope
- type TraceSink
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DoValueTrace ¶
func SetTraceSink ¶
func SetTraceSink(sink TraceSink)
func TxValueTrace ¶
func WithTraceScope ¶
func WithTraceScope(scope TraceScope, fn func())
Types ¶
type Actor ¶
type Actor struct {
// contains filtered or unexported fields
}
Actor 是单 writer goroutine 排队写的执行器。 设计约束: - 写请求只能走 WriteTx,写连接只有一条 - 读请求走 Read,使用独立只读连接 - 所有查询句柄禁止带出闭包
type TraceEvent ¶
type TraceEvent struct {
TS string `json:"ts"`
Operation string `json:"operation"`
SQL string `json:"sql"`
SQLFingerprint string `json:"sql_fingerprint"`
Args []any `json:"args,omitempty"`
ElapsedMS int64 `json:"elapsed_ms"`
RowsAffected int64 `json:"rows_affected"`
Err string `json:"err,omitempty"`
RoundID string `json:"round_id,omitempty"`
Trigger string `json:"trigger,omitempty"`
Intent string `json:"intent,omitempty"`
Stage string `json:"stage,omitempty"`
CallerChain []string `json:"caller_chain,omitempty"`
}
TraceEvent 是单条 SQL 的追踪记录。
Click to show internal directories.
Click to hide internal directories.