Documentation
¶
Overview ¶
Package id defines TypeID-based identity types for all Sentinel entities.
Every entity in Sentinel uses a single ID struct with a prefix that identifies the entity type. IDs are K-sortable (UUIDv7-based), globally unique, and URL-safe in the format "prefix_suffix".
Index ¶
- type AnyID
- type BaselineID
- type CaseID
- type EvalResultID
- type EvalRunID
- type ID
- func MustParse(s string) ID
- func MustParseWithPrefix(s string, expected Prefix) ID
- func New(prefix Prefix) ID
- func NewBaselineID() ID
- func NewCaseID() ID
- func NewEvalResultID() ID
- func NewEvalRunID() ID
- func NewPromptVersionID() ID
- func NewRedTeamID() ID
- func NewSuiteID() ID
- func Parse(s string) (ID, error)
- func ParseAny(s string) (ID, error)
- func ParseBaselineID(s string) (ID, error)
- func ParseCaseID(s string) (ID, error)
- func ParseEvalResultID(s string) (ID, error)
- func ParseEvalRunID(s string) (ID, error)
- func ParsePromptVersionID(s string) (ID, error)
- func ParseRedTeamID(s string) (ID, error)
- func ParseSuiteID(s string) (ID, error)
- func ParseWithPrefix(s string, expected Prefix) (ID, error)
- func (i ID) IsNil() bool
- func (i ID) MarshalBSONValue() (bsonType byte, data []byte, err error)
- func (i ID) MarshalText() ([]byte, error)
- func (i ID) Prefix() Prefix
- func (i *ID) Scan(src any) error
- func (i ID) String() string
- func (i *ID) UnmarshalBSONValue(t byte, data []byte) error
- func (i *ID) UnmarshalText(data []byte) error
- func (i ID) Value() (driver.Value, error)
- type Prefix
- type PromptVersionID
- type RedTeamID
- type SuiteID
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaselineID ¶
type BaselineID = ID
BaselineID is a type-safe identifier for baselines (prefix: "base").
type EvalResultID ¶
type EvalResultID = ID
EvalResultID is a type-safe identifier for evaluation results (prefix: "eres").
type EvalRunID ¶
type EvalRunID = ID
EvalRunID is a type-safe identifier for evaluation runs (prefix: "erun").
type ID ¶
type ID struct {
// contains filtered or unexported fields
}
ID is the primary identifier type for all Sentinel entities. It wraps a TypeID providing a prefix-qualified, globally unique, sortable, URL-safe identifier in the format "prefix_suffix".
var Nil ID
Nil is the zero-value ID.
func MustParseWithPrefix ¶
MustParseWithPrefix is like ParseWithPrefix but panics on error.
func New ¶
New generates a new globally unique ID with the given prefix. It panics if prefix is not a valid TypeID prefix (programming error).
func NewEvalResultID ¶
func NewEvalResultID() ID
NewEvalResultID generates a new unique eval result ID.
func NewPromptVersionID ¶
func NewPromptVersionID() ID
NewPromptVersionID generates a new unique prompt version ID.
func Parse ¶
Parse parses a TypeID string (e.g., "suite_01h2xcejqtf2nbrexx3vqjhp41") into an ID. Returns an error if the string is not valid.
func ParseBaselineID ¶
ParseBaselineID parses a string and validates the "base" prefix.
func ParseCaseID ¶
ParseCaseID parses a string and validates the "tcase" prefix.
func ParseEvalResultID ¶
ParseEvalResultID parses a string and validates the "eres" prefix.
func ParseEvalRunID ¶
ParseEvalRunID parses a string and validates the "erun" prefix.
func ParsePromptVersionID ¶
ParsePromptVersionID parses a string and validates the "pver" prefix.
func ParseRedTeamID ¶
ParseRedTeamID parses a string and validates the "rteam" prefix.
func ParseSuiteID ¶
ParseSuiteID parses a string and validates the "suite" prefix.
func ParseWithPrefix ¶
ParseWithPrefix parses a TypeID string and validates that its prefix matches the expected value.
func (ID) MarshalBSONValue ¶
MarshalBSONValue satisfies bson.ValueMarshaler (mongo-driver v2) so the ID is stored as a BSON string instead of an opaque struct. No bson import needed because Go uses structural typing for interface satisfaction.
func (ID) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (ID) String ¶
String returns the full TypeID string representation (prefix_suffix). Returns an empty string for the Nil ID.
func (*ID) UnmarshalBSONValue ¶
UnmarshalBSONValue satisfies bson.ValueUnmarshaler (mongo-driver v2).
func (*ID) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
type PromptVersionID ¶
type PromptVersionID = ID
PromptVersionID is a type-safe identifier for prompt versions (prefix: "pver").