Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BooleanQuery ¶
type BooleanQuery struct {
Must []Filter // AND conditions
Should []Filter // OR conditions
MustNot []Filter // NOT conditions
Nested *BooleanQuery // Nested boolean query (for parentheses)
}
BooleanQuery represents a boolean combination of filters
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder handles converting queries into SQL
func NewBuilder ¶
func NewBuilder() *Builder
NewBuilder creates a new query builder with default assets table config
func NewSearchIndexBuilder ¶ added in v0.6.0
func NewSearchIndexBuilder() *Builder
NewSearchIndexBuilder creates a builder optimized for search_index table
func (*Builder) BuildConditions ¶
func (b *Builder) BuildConditions(bq *BooleanQuery) ([]string, []interface{}, error)
func (*Builder) BuildSearchConditions ¶ added in v0.6.0
func (b *Builder) BuildSearchConditions(q *Query, startParam int) ([]string, []interface{}, int, error)
BuildSearchConditions builds WHERE clause conditions from a Query struct. Returns conditions, params, next param index, and any error. This is designed for integration with custom query builders like the search store.
type FieldType ¶ added in v0.4.0
type FieldType string
FieldType represents the type of field being queried
type Filter ¶
type Filter struct {
Field []string // Field to filter on (e.g., "metadata.owner")
FieldType FieldType // Type of field (metadata, type, provider, kind)
Operator Operator // Operator (e.g., =, :, contains)
Value interface{} // Value to compare against
Range *RangeValue // Range values for range queries
OrigQuery string
}
Filter represents a single filter condition
type Operator ¶
type Operator string
Operator represents the type of filter operation
const ( OpEquals Operator = "=" OpContains Operator = "contains" OpNotEquals Operator = "!=" OpGreater Operator = ">" OpLess Operator = "<" OpGreaterEqual Operator = ">=" OpLessEqual Operator = "<=" OpIn Operator = "in" OpNotIn Operator = "not in" OpRange Operator = "range" OpWildcard Operator = "wildcard" OpFreeText Operator = "freetext" )
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser handles parsing of search queries into structured formats
type Query ¶
type Query struct {
FreeText string // General text search
Filters []Filter // Specific field filters
Bool *BooleanQuery // Boolean combinations of filters
}
Query represents a parsed search query with specific conditions
func (*Query) CanUseCompositeIndex ¶ added in v0.6.0
CanUseCompositeIndex checks if the query can efficiently use a composite index. Returns true if it's a simple single-field exact match on type or provider.
func (*Query) GetFreeText ¶ added in v0.6.0
GetFreeText returns the free text portion of the query
func (*Query) HasStructuredFilters ¶ added in v0.6.0
HasStructuredFilters returns true if the query has any structured filters
type RangeValue ¶
type RangeValue struct {
From interface{}
To interface{}
Inclusive bool
}
RangeValue represents a range query with optional bounds
type TableConfig ¶ added in v0.6.0
type TableConfig struct {
TypeColumn string // "type" for assets, "asset_type" for search_index
ProviderColumn string // "providers" for both
NameColumn string // "name" for both
MetadataColumn string // "metadata" for both
}
TableConfig specifies column names for different tables
func DefaultAssetsConfig ¶ added in v0.6.0
func DefaultAssetsConfig() TableConfig
DefaultAssetsConfig returns column config for the assets table
func SearchIndexConfig ¶ added in v0.6.0
func SearchIndexConfig() TableConfig
SearchIndexConfig returns column config for the search_index table