Documentation
¶
Index ¶
- Constants
- Variables
- type AndExpression
- type Comparison
- type EntityPropertyMap
- type EntityType
- type Expression
- type FilterExpression
- type OrExpression
- type PropertyDefinition
- type PropertyLocation
- type PropertyRef
- type PropertyReference
- type QueryBuilder
- type RestEntityType
- type SingleValue
- type Term
- type Value
- type ValueList
- type WhereClause
Constants ¶
const ( StringValueType = "string_value" DoubleValueType = "double_value" IntValueType = "int_value" BoolValueType = "bool_value" )
Constants for property value types
Variables ¶
var RestEntityPropertyMap = map[RestEntityType]map[string]bool{ RestEntityRegisteredModel: { "id": true, "name": true, "externalId": true, "createTimeSinceEpoch": true, "lastUpdateTimeSinceEpoch": true, "state": true, "owner": true, }, RestEntityModelVersion: { "id": true, "name": true, "externalId": true, "createTimeSinceEpoch": true, "lastUpdateTimeSinceEpoch": true, "registeredModelId": true, "state": true, "author": true, }, RestEntityInferenceService: { "id": true, "name": true, "externalId": true, "createTimeSinceEpoch": true, "lastUpdateTimeSinceEpoch": true, "registeredModelId": true, "modelVersionId": true, "servingEnvironmentId": true, "runtime": true, "desiredState": true, }, RestEntityServingEnvironment: { "id": true, "name": true, "externalId": true, "createTimeSinceEpoch": true, "lastUpdateTimeSinceEpoch": true, }, RestEntityExperiment: { "id": true, "name": true, "externalId": true, "createTimeSinceEpoch": true, "lastUpdateTimeSinceEpoch": true, "state": true, "owner": true, }, RestEntityExperimentRun: { "id": true, "name": true, "externalId": true, "createTimeSinceEpoch": true, "lastUpdateTimeSinceEpoch": true, "experimentId": true, "startTimeSinceEpoch": true, "endTimeSinceEpoch": true, "status": true, "state": true, "owner": true, }, RestEntityModelArtifact: { "id": true, "name": true, "externalId": true, "createTimeSinceEpoch": true, "lastUpdateTimeSinceEpoch": true, "uri": true, "state": true, "modelFormatName": true, "modelFormatVersion": true, "storageKey": true, "storagePath": true, "serviceAccountName": true, "modelSourceKind": true, "modelSourceClass": true, "modelSourceGroup": true, "modelSourceId": true, "modelSourceName": true, "experimentId": true, "experimentRunId": true, }, RestEntityDocArtifact: { "id": true, "name": true, "externalId": true, "createTimeSinceEpoch": true, "lastUpdateTimeSinceEpoch": true, "uri": true, "state": true, "experimentId": true, "experimentRunId": true, }, RestEntityDataSet: { "id": true, "name": true, "externalId": true, "createTimeSinceEpoch": true, "lastUpdateTimeSinceEpoch": true, "uri": true, "state": true, "digest": true, "sourceType": true, "source": true, "schema": true, "profile": true, "experimentId": true, "experimentRunId": true, }, RestEntityMetric: { "id": true, "name": true, "externalId": true, "createTimeSinceEpoch": true, "lastUpdateTimeSinceEpoch": true, "uri": true, "state": true, "value": true, "timestamp": true, "step": true, "experimentId": true, "experimentRunId": true, }, RestEntityParameter: { "id": true, "name": true, "externalId": true, "createTimeSinceEpoch": true, "lastUpdateTimeSinceEpoch": true, "uri": true, "state": true, "value": true, "parameterType": true, "experimentId": true, "experimentRunId": true, }, RestEntityServeModel: { "id": true, "name": true, "externalId": true, "createTimeSinceEpoch": true, "lastUpdateTimeSinceEpoch": true, "lastKnownState": true, "modelVersionId": true, "inferenceServiceId": true, "registeredModelId": true, "servingEnvironmentId": true, }, }
RestEntityPropertyMap maps REST entity types to their allowed properties
Functions ¶
This section is empty.
Types ¶
type AndExpression ¶
type Comparison ¶
type Comparison struct {
Left *PropertyRef `@@`
Operator string `@("=" | "!=" | "<>" | ">=" | "<=" | ">" | "<" | "LIKE" | "ILIKE" | "IN")`
Right *Value `@@`
}
type EntityPropertyMap ¶
type EntityPropertyMap map[string]PropertyDefinition
EntityPropertyMap maps property names to their definitions for each entity type
type EntityType ¶
type EntityType string
EntityType represents the type of entity for proper query building
const ( EntityTypeContext EntityType = "context" EntityTypeArtifact EntityType = "artifact" EntityTypeExecution EntityType = "execution" )
func GetMLMDEntityType ¶
func GetMLMDEntityType(restEntityType RestEntityType) EntityType
GetMLMDEntityType maps REST entity types to their underlying MLMD entity type
type Expression ¶
type Expression struct {
Or *OrExpression `@@`
}
type FilterExpression ¶
type FilterExpression struct {
Left *FilterExpression
Right *FilterExpression
Operator string
Property string
Value interface{}
IsLeaf bool
}
FilterExpression represents a parsed filter expression (keeping for compatibility)
func Parse ¶
func Parse(input string) (*FilterExpression, error)
Parse parses a filter query string and returns the root expression This function is thread-safe and reuses a singleton parser instance
type OrExpression ¶
type OrExpression struct {
Left *AndExpression `@@`
Right []*AndExpression `("OR" @@)*`
}
type PropertyDefinition ¶
type PropertyDefinition struct {
Location PropertyLocation
ValueType string // IntValueType, StringValueType, DoubleValueType, BoolValueType
Column string // Database column name (for entity table) or property name (for property table)
}
PropertyDefinition defines how a property should be handled
func GetPropertyDefinition ¶
func GetPropertyDefinition(entityType EntityType, propertyName string) PropertyDefinition
GetPropertyDefinition returns the property definition for a given entity type and property name
func GetPropertyDefinitionForRestEntity ¶
func GetPropertyDefinitionForRestEntity(restEntityType RestEntityType, propertyName string) PropertyDefinition
GetPropertyDefinitionForRestEntity returns property definition for a REST entity type This function determines the correct data type and storage location for properties
type PropertyLocation ¶
type PropertyLocation int
PropertyLocation indicates where a property is stored
const ( EntityTable PropertyLocation = iota // Property is a column in the main entity table PropertyTable // Property is stored in the entity's property table Custom // Property is a custom property in the property table )
type PropertyRef ¶
type PropertyReference ¶
type PropertyReference struct {
Name string
IsCustom bool
ValueType string // StringValueType, DoubleValueType, IntValueType, BoolValueType
IsEscaped bool // whether the property name was escaped with backticks
}
PropertyReference represents a property reference with type information
type QueryBuilder ¶
type QueryBuilder struct {
// contains filtered or unexported fields
}
QueryBuilder builds GORM queries from filter expressions It handles special cases like prefixed names for child entities (e.g., ModelVersion, ExperimentRun) where names are stored as "parentId:actualName" in the database
func NewQueryBuilderForRestEntity ¶
func NewQueryBuilderForRestEntity(restEntityType RestEntityType) *QueryBuilder
NewQueryBuilderForRestEntity creates a new query builder for the specified REST entity type
func (*QueryBuilder) BuildQuery ¶
func (qb *QueryBuilder) BuildQuery(db *gorm.DB, expr *FilterExpression) *gorm.DB
BuildQuery builds a GORM query from a filter expression
func (*QueryBuilder) ConvertStateValue ¶ added in v0.3.1
func (qb *QueryBuilder) ConvertStateValue(propertyName string, value any) any
ConvertStateValue converts string state values to integers based on entity type
type RestEntityType ¶
type RestEntityType string
RestEntityType represents the specific REST API entity type
const ( // Context-based REST entities RestEntityRegisteredModel RestEntityType = "RegisteredModel" RestEntityModelVersion RestEntityType = "ModelVersion" RestEntityInferenceService RestEntityType = "InferenceService" RestEntityServingEnvironment RestEntityType = "ServingEnvironment" RestEntityExperiment RestEntityType = "Experiment" RestEntityExperimentRun RestEntityType = "ExperimentRun" // Artifact-based REST entities RestEntityModelArtifact RestEntityType = "ModelArtifact" RestEntityDocArtifact RestEntityType = "DocArtifact" RestEntityDataSet RestEntityType = "DataSet" RestEntityMetric RestEntityType = "Metric" RestEntityParameter RestEntityType = "Parameter" // Execution-based REST entities RestEntityServeModel RestEntityType = "ServeModel" )
type SingleValue ¶
type Term ¶
type Term struct {
Group *Expression `"(" @@ ")"`
Comparison *Comparison `| @@`
}
type ValueList ¶
type ValueList struct {
Values []*SingleValue `"(" (@@ ("," @@)*)? ")"`
}
type WhereClause ¶
type WhereClause struct {
Expression *Expression `@@`
}