feat: complete contract-driven business development and MySQL integration

This commit is contained in:
2026-09-24 21:56:04 +08:00
parent f9afb8f8dd
commit f5478cdc76
108 changed files with 6557 additions and 550 deletions

22
httpx/metadata.go Normal file
View File

@@ -0,0 +1,22 @@
package httpx
import "context"
// RequestMetadata is a value snapshot for Logic. It excludes credentials,
// query strings, headers and bodies. ClientIP is resolved by App's proxy policy.
type RequestMetadata struct{ ClientIP, Method, Route string }
type metadataKey struct{}
func WithRequestMetadata(ctx context.Context, value RequestMetadata) context.Context {
if ctx == nil {
ctx = context.Background()
}
return context.WithValue(ctx, metadataKey{}, value)
}
func Metadata(ctx context.Context) RequestMetadata {
if ctx == nil {
return RequestMetadata{}
}
value, _ := ctx.Value(metadataKey{}).(RequestMetadata)
return value
}