Documentation
¶
Overview ¶
Package contextutil discovers the EvaluationContext proto message and extracts dimension metadata for codegen backends.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContextDef ¶
type ContextDef struct {
MessageName string // fully qualified message name
Dimensions []DimensionDef // dimensions in field-number order
Message *protogen.Message
}
ContextDef holds the discovered EvaluationContext message and its dimensions.
func DiscoverContext ¶
func DiscoverContext(plugin *protogen.Plugin) (*ContextDef, error)
DiscoverContext scans all files in the plugin request for a message annotated with option (pbflags.context). Returns the context definition, or nil if none is found. Returns an error if multiple are found or if validation fails.
type DimensionDef ¶
type DimensionDef struct {
Name string // proto field name (e.g., "user_id")
Number int32 // proto field number
Kind DimensionKind // dimension type
Description string // from DimensionOptions.description
Hashable bool // from DimensionOptions.hashable
Bounded bool // from DimensionOptions.bounded
// Enum-specific metadata (only populated when Kind == DimensionEnum).
EnumName string // fully qualified enum name
EnumValues []EnumValueDef // enum values
ProtoField *protogen.Field // original protogen field for codegen access
}
DimensionDef describes a single dimension field in the EvaluationContext.
type DimensionKind ¶
type DimensionKind int
DimensionKind enumerates the supported proto types for context dimensions.
const ( DimensionString DimensionKind = iota DimensionEnum DimensionBool DimensionInt64 )
func (DimensionKind) String ¶
func (k DimensionKind) String() string
type EnumValueDef ¶
type EnumValueDef struct {
Name string // proto enum value name (e.g., "PLAN_LEVEL_ENTERPRISE")
Number int32 // ordinal
}
EnumValueDef describes a single enum value.
Click to show internal directories.
Click to hide internal directories.