Documentation
¶
Index ¶
- func ConvertToJSONQuery(query string) string
- func FormatMapForCQL(m map[string]string) string
- func FormatTableCreateStatement(tableInfo *TableInfo, includeHeader bool) string
- func FormatValue(val interface{}) string
- func TypeInfoToString(typeInfo gocql.TypeInfo) string
- func TypeToString(t gocql.Type) string
- type AggregateInfo
- type AggregateListInfo
- type BinaryDecoder
- type CQLTypeHandler
- type CQLTypeInfo
- type CachedTableInfo
- type ClusterInfo
- type ColumnInfo
- type ColumnSchema
- type FunctionDetails
- type IndexInfo
- type KeyColumnInfo
- type KeyspaceInfo
- type KeyspaceListInfo
- type KeyspaceSchema
- type MaterializedViewInfo
- type PermissionInfo
- type QueryResult
- type RawBytes
- type RoleInfo
- type SchemaCache
- func (sc *SchemaCache) CountTotalTables() int
- func (sc *SchemaCache) GetAllKeyspaces() ([]string, error)
- func (sc *SchemaCache) GetCachedTableCount(keyspace string) int
- func (sc *SchemaCache) GetKeyspaceTables(keyspace string) ([]CachedTableInfo, error)
- func (sc *SchemaCache) GetTableColumns(keyspace, table string) ([]ColumnInfo, error)
- func (sc *SchemaCache) GetTableInfo(keyspace, table string) (*TableInfo, error)
- func (sc *SchemaCache) GetTableSchema(keyspace, table string) (*TableSchema, error)
- func (sc *SchemaCache) IsInitialized() bool
- func (sc *SchemaCache) Refresh() error
- func (sc *SchemaCache) RefreshIfNeeded(maxAge time.Duration) error
- type SchemaCatalog
- type SearchIndex
- type Session
- func (s *Session) AddToBatch(batch *gocql.Batch, query string)
- func (s *Session) AutoFetch() bool
- func (s *Session) CassandraVersion() string
- func (s *Session) Consistency() string
- func (s *Session) CreateBatch(batchType gocql.BatchType) *gocql.Batch
- func (s *Session) DBDescribeAggregate(sessionMgr *session.Manager, aggregateName string) (interface{}, *AggregateInfo, error)
- func (s *Session) DBDescribeAggregates(sessionMgr *session.Manager) (interface{}, []AggregateListInfo, error)
- func (s *Session) DBDescribeCluster() (interface{}, *ClusterInfo, error)
- func (s *Session) DBDescribeFullSchema(sessionMgr *session.Manager, keyspace string) (interface{}, error)
- func (s *Session) DBDescribeFunction(sessionMgr *session.Manager, functionName string) (interface{}, []FunctionDetails, error)
- func (s *Session) DBDescribeFunctionByName(functionName string, keyspaceName string) (interface{}, error)
- func (s *Session) DBDescribeFunctions(sessionMgr *session.Manager) (interface{}, bool, error)
- func (s *Session) DBDescribeIndex(sessionMgr *session.Manager, indexName string) (interface{}, *IndexInfo, error)
- func (s *Session) DBDescribeKeyspace(keyspaceName string) (interface{}, *KeyspaceInfo, error)
- func (s *Session) DBDescribeKeyspaces() (interface{}, []KeyspaceListInfo, error)
- func (s *Session) DBDescribeMaterializedView(sessionMgr *session.Manager, viewName string) (interface{}, *MaterializedViewInfo, error)
- func (s *Session) DBDescribeMaterializedViews(sessionMgr *session.Manager) (interface{}, error)
- func (s *Session) DBDescribeTable(sessionMgr *session.Manager, tableName string) (interface{}, *TableInfo, error)
- func (s *Session) DBDescribeTables(sessionMgr *session.Manager) (interface{}, []TableListInfo, error)
- func (s *Session) DBDescribeType(sessionMgr *session.Manager, typeName string) (interface{}, *TypeInfo, error)
- func (s *Session) DBDescribeTypes(sessionMgr *session.Manager) (interface{}, []TypeListInfo, error)
- func (s *Session) DescribeAggregateQuery(keyspace string, aggregateName string) (*AggregateInfo, error)
- func (s *Session) DescribeAggregatesQuery(keyspace string) ([]AggregateListInfo, error)
- func (s *Session) DescribeAllTablesQuery() ([]TableListInfo, error)
- func (s *Session) DescribeClusterQuery() (*ClusterInfo, error)
- func (s *Session) DescribeFunctionQuery(currentKeyspace string, functionName string) ([]FunctionDetails, error)
- func (s *Session) DescribeFunctionsQuery(currentKeyspace string) ([][]string, error)
- func (s *Session) DescribeIndexQuery(keyspace string, indexName string) (*IndexInfo, error)
- func (s *Session) DescribeIndexQueryWithTable(keyspace string, tableName string, indexName string) (*IndexInfo, error)
- func (s *Session) DescribeKeyspaceQuery(keyspaceName string) (*KeyspaceInfo, error)
- func (s *Session) DescribeKeyspacesQuery() ([]KeyspaceListInfo, error)
- func (s *Session) DescribeMaterializedViewQuery(keyspace string, viewName string) (*MaterializedViewInfo, error)
- func (s *Session) DescribeTableQuery(keyspace string, tableName string) (*TableInfo, error)
- func (s *Session) DescribeTablesQuery(keyspace string) ([]TableListInfo, error)
- func (s *Session) DescribeTypeQuery(keyspace string, typeName string) (*TypeInfo, error)
- func (s *Session) DescribeTypesQuery(keyspace string) ([]TypeListInfo, error)
- func (s *Session) ExecuteBatch(batch *gocql.Batch) error
- func (s *Session) ExecuteCQLQuery(query string) interface{}
- func (s *Session) ExecuteDMLCommand(query string) error
- func (s *Session) ExecuteRoleCommand(query string) error
- func (s *Session) ExecuteSelectQuery(query string) interface{}
- func (s *Session) ExecuteStreamingQuery(query string) interface{}
- func (s *Session) GetColumnTypeFromSystemTable(keyspace, table, column string) string
- func (s *Session) GetCurrentKeyspaceSchema(sessionMgr *session.Manager) (*KeyspaceSchema, error)
- func (s *Session) GetCurrentKeyspaceSchemaUsingMetadata(sessionMgr *session.Manager) (*KeyspaceSchema, error)
- func (s *Session) GetKeyColumns(query string) map[string]KeyColumnInfo
- func (s *Session) GetKeyspaceMetadata(keyspace string) (*gocql.KeyspaceMetadata, error)
- func (s *Session) GetKeyspaceSchema(keyspace string) (*KeyspaceSchema, error)
- func (s *Session) GetKeyspaceSchemaUsingMetadata(keyspace string) (*KeyspaceSchema, error)
- func (s *Session) GetMaterializedViewMetadata(keyspace, viewName string) (*gocql.MaterializedViewMetadata, error)
- func (s *Session) GetSchemaCache() *SchemaCache
- func (s *Session) GetSchemaCatalog() (*SchemaCatalog, error)
- func (s *Session) GetSchemaContext(limit int) (string, error)
- func (s *Session) GetTableMetadata(keyspace, table string) (*gocql.TableMetadata, error)
- func (s *Session) GetTableSchema(keyspace, table string) (*TableSchema, error)
- func (s *Session) GetTableSchemaUsingMetadata(keyspace, table string) (*TableSchema, error)
- func (s *Session) GetTraceData() ([][]string, []string, *TraceInfo, error)
- func (s *Session) GetUDTRegistry() *UDTRegistry
- func (s *Session) GetUserTypeMetadata(keyspace, typeName string) (*gocql.UserTypeMetadata, error)
- func (s *Session) IsVersion3OrHigher() bool
- func (s *Session) IsVersion4OrHigher() bool
- func (s *Session) Keyspace() string
- func (s *Session) ListPermissions() ([]PermissionInfo, error)
- func (s *Session) ListPermissionsForRole(roleName string) ([]PermissionInfo, error)
- func (s *Session) ListRoles() ([]RoleInfo, error)
- func (s *Session) LoadKeyspaceUDTsUsingMetadata(keyspace string) error
- func (s *Session) PageSize() int
- func (s *Session) ProcessStreamingQuery(result StreamingQueryResult) *StreamingResult
- func (s *Session) Query(stmt string, values ...interface{}) *gocql.Query
- func (s *Session) SetAutoFetch(enabled bool)
- func (s *Session) SetConsistency(level string) error
- func (s *Session) SetKeyspace(keyspace string) error
- func (s *Session) SetPageSize(size int)
- func (s *Session) SetTracing(enabled bool)
- func (s *Session) SetUDTRegistry(registry *UDTRegistry)
- func (s *Session) Tracing() bool
- func (s *Session) Username() string
- type SessionOptions
- type StreamingProcessor
- type StreamingQueryResult
- type StreamingResult
- type TableInfo
- type TableListInfo
- type TableSchema
- type TraceInfo
- type TypeInfo
- type TypeListInfo
- type UDTDefinition
- type UDTField
- type UDTRegistry
- func (r *UDTRegistry) Clear()
- func (r *UDTRegistry) ClearKeyspace(keyspace string)
- func (r *UDTRegistry) GetAllUDTs(keyspace string) map[string]*UDTDefinition
- func (r *UDTRegistry) GetUDTDefinition(keyspace, udtName string) (*UDTDefinition, error)
- func (r *UDTRegistry) GetUDTDefinitionOrLoad(keyspace, udtName string) (*UDTDefinition, error)
- func (r *UDTRegistry) HasUDT(keyspace, udtName string) bool
- func (r *UDTRegistry) LoadKeyspaceUDTs(keyspace string) error
- func (r *UDTRegistry) LoadKeyspaceUDTsUsingMetadata(keyspace string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertToJSONQuery ¶
ConvertToJSONQuery converts a SELECT query to SELECT JSON format This is now a public method so it can be called from the router/UI layer when needed
func FormatMapForCQL ¶ added in v0.0.11
FormatMapForCQL formats a map for CQL output (for keyspaces, indexes, etc.)
func FormatTableCreateStatement ¶ added in v0.0.11
FormatTableCreateStatement formats a CREATE TABLE statement If includeHeader is true, adds "Table: keyspace.table" header (for DESCRIBE TABLE)
func FormatValue ¶ added in v0.0.5
func FormatValue(val interface{}) string
FormatValue formats any value for display, handling nested structures This is called for top-level values, so strings should NOT be quoted
func TypeInfoToString ¶
TypeInfoToString converts a gocql.TypeInfo to its string representation
func TypeToString ¶
TypeToString converts a gocql.Type to its string representation
Types ¶
type AggregateInfo ¶
type AggregateInfo struct {
Name string
ArgumentTypes []string
StateFunc string
StateType string
FinalFunc string
InitCond string
ReturnType string
}
AggregateInfo holds aggregate information for manual describe
type AggregateListInfo ¶
type AggregateListInfo struct {
Name string
ArgumentTypes []string
StateType string
ReturnType string
}
AggregateListInfo holds aggregate list information for manual describe
type BinaryDecoder ¶ added in v0.0.5
type BinaryDecoder struct {
// contains filtered or unexported fields
}
BinaryDecoder handles decoding of Cassandra binary protocol data
func NewBinaryDecoder ¶ added in v0.0.5
func NewBinaryDecoder(registry *UDTRegistry) *BinaryDecoder
NewBinaryDecoder creates a new binary decoder with the given UDT registry
func (*BinaryDecoder) Decode ¶ added in v0.0.5
func (d *BinaryDecoder) Decode(data []byte, typeInfo *CQLTypeInfo, keyspace string) (interface{}, error)
Decode decodes binary data based on the type information
type CQLTypeHandler ¶
type CQLTypeHandler struct {
// Configuration options
TimeFormat string // Format for time display (default RFC3339)
HexPrefix string // Prefix for hex values (default "0x")
NullString string // String to display for null values (default "null")
CollectionLimit int // Max items to display in collections (0 = unlimited)
TruncateStrings int // Max length for strings (0 = no truncation)
}
CQLTypeHandler provides standardized handling for all Cassandra/CQL data types
func NewCQLTypeHandler ¶
func NewCQLTypeHandler() *CQLTypeHandler
NewCQLTypeHandler creates a new type handler with default settings
func (*CQLTypeHandler) FormatValue ¶
func (h *CQLTypeHandler) FormatValue(val interface{}, typeInfo gocql.TypeInfo) string
FormatValue formats any CQL value for display
type CQLTypeInfo ¶ added in v0.0.5
type CQLTypeInfo struct {
BaseType string // "text", "int", "list", "map", "udt", etc.
Frozen bool // Whether the type is frozen
Parameters []*CQLTypeInfo // For collections/tuples - element types
UDTName string // For UDT types - the name of the UDT
Keyspace string // For UDT types - optional keyspace qualifier
}
CQLTypeInfo represents parsed CQL type information
func ParseCQLType ¶ added in v0.0.5
func ParseCQLType(typeStr string) (*CQLTypeInfo, error)
ParseCQLType parses a CQL type string into structured type information
func (*CQLTypeInfo) String ¶ added in v0.0.5
func (t *CQLTypeInfo) String() string
String returns a string representation of the TypeInfo
type CachedTableInfo ¶
type CachedTableInfo struct {
TableInfo
RowCount int64 // Optional: cached approximate count
LastUpdated time.Time
}
CachedTableInfo extends TableInfo with cache-specific fields
type ClusterInfo ¶
ClusterInfo holds cluster information for manual describe
type ColumnInfo ¶
ColumnInfo holds column information
type ColumnSchema ¶
type ColumnSchema struct {
Name string
Type string
Kind string // 'partition_key', 'clustering', 'regular', 'static'
Position int // Position for partition/clustering keys
}
ColumnSchema represents a column's schema
type FunctionDetails ¶
type FunctionDetails struct {
Name string
ArgumentTypes []string
ArgumentNames []string
ReturnType string
Language string
Body string
CalledOnNull bool
}
FunctionDetails holds the details of a function for describe operations
type KeyColumnInfo ¶
KeyColumnInfo holds information about key columns
type KeyspaceInfo ¶
KeyspaceInfo holds keyspace information for manual describe
type KeyspaceListInfo ¶
KeyspaceListInfo holds keyspace list information for manual describe
type KeyspaceSchema ¶
type KeyspaceSchema struct {
Name string
Tables map[string]*TableSchema
}
KeyspaceSchema represents a keyspace's schema
type MaterializedViewInfo ¶
type MaterializedViewInfo struct {
Name string
BaseTable string
WhereClause string
BloomFilterFpChance float64
Caching string
Comment string
Compaction map[string]string
Compression map[string]string
CrcCheckChance float64
DclocalReadRepairChance float64
DefaultTTL int
GcGrace int
MaxIndexInterval int
MemtableFlushPeriod int
MinIndexInterval int
ReadRepairChance float64
SpeculativeRetry string
PartitionKeys []string
ClusteringKeys []string
}
MaterializedViewInfo holds materialized view information for manual describe
type PermissionInfo ¶
PermissionInfo holds permission information from system_auth.role_permissions
type QueryResult ¶
type QueryResult struct {
Data [][]string // Formatted strings for display
RawData []map[string]interface{} // Raw values for JSON export (preserves types)
Duration time.Duration
RowCount int
ColumnTypes []string // Data types of each column
ColumnTypeInfos []gocql.TypeInfo // TypeInfo objects for each column (for UDT support)
Headers []string // Column names without PK/C indicators
}
QueryResult wraps query results with metadata
type RawBytes ¶ added in v0.0.5
type RawBytes []byte
RawBytes is a custom type to capture raw bytes from gocql for types like UDTs that gocql cannot decode without compile-time type information
func (RawBytes) MarshalCQL ¶ added in v0.0.5
MarshalCQL implements gocql.Marshaler interface
type RoleInfo ¶
type RoleInfo struct {
Role string
CanLogin bool
IsSuperuser bool
MemberOf []string
SaltedHash string
}
RoleInfo holds role information from system_auth.roles
type SchemaCache ¶
type SchemaCache struct {
Keyspaces []string
Tables map[string][]CachedTableInfo // keyspace -> tables
Columns map[string]map[string][]ColumnInfo // keyspace -> table -> columns
SearchIndex *SearchIndex // Pre-computed fuzzy search index
LastRefresh time.Time
Mu sync.RWMutex
// contains filtered or unexported fields
}
SchemaCache provides schema information using gocql's metadata API This replaces the old implementation that maintained its own cache
func NewSchemaCache ¶
func NewSchemaCache(session *Session) *SchemaCache
NewSchemaCache creates a new schema cache using gocql metadata
func (*SchemaCache) CountTotalTables ¶
func (sc *SchemaCache) CountTotalTables() int
CountTotalTables returns the total number of tables across all keyspaces
func (*SchemaCache) GetAllKeyspaces ¶ added in v0.0.5
func (sc *SchemaCache) GetAllKeyspaces() ([]string, error)
GetAllKeyspaces returns all non-system keyspaces Note: gocql doesn't provide a direct method to list all keyspaces, so we need to query system tables for this specific case
func (*SchemaCache) GetCachedTableCount ¶ added in v0.0.5
func (sc *SchemaCache) GetCachedTableCount(keyspace string) int
GetCachedTableCount returns approximate count (not cached with metadata API)
func (*SchemaCache) GetKeyspaceTables ¶ added in v0.0.5
func (sc *SchemaCache) GetKeyspaceTables(keyspace string) ([]CachedTableInfo, error)
GetKeyspaceTables returns all tables for a specific keyspace using gocql metadata
func (*SchemaCache) GetTableColumns ¶ added in v0.0.5
func (sc *SchemaCache) GetTableColumns(keyspace, table string) ([]ColumnInfo, error)
GetTableColumns returns columns for a specific table using gocql metadata
func (*SchemaCache) GetTableInfo ¶ added in v0.0.5
func (sc *SchemaCache) GetTableInfo(keyspace, table string) (*TableInfo, error)
GetTableInfo retrieves information about a specific table
func (*SchemaCache) GetTableSchema ¶
func (sc *SchemaCache) GetTableSchema(keyspace, table string) (*TableSchema, error)
GetTableSchema returns schema information for a specific table This method is used by AI components for query context
func (*SchemaCache) IsInitialized ¶ added in v0.0.5
func (sc *SchemaCache) IsInitialized() bool
IsInitialized checks if the schema cache has been populated
func (*SchemaCache) Refresh ¶
func (sc *SchemaCache) Refresh() error
Refresh loads or refreshes the schema metadata With gocql's metadata API, this mainly updates the search index
func (*SchemaCache) RefreshIfNeeded ¶ added in v0.0.5
func (sc *SchemaCache) RefreshIfNeeded(maxAge time.Duration) error
RefreshIfNeeded refreshes the cache if it's older than the specified duration
type SchemaCatalog ¶
type SchemaCatalog struct {
Keyspaces map[string]*KeyspaceSchema
}
SchemaCatalog holds all schema information
type SearchIndex ¶
SearchIndex contains pre-computed data for fuzzy searching
type Session ¶
Session is a wrapper around the gocql.Session.
func NewSessionWithOptions ¶
func NewSessionWithOptions(options SessionOptions) (*Session, error)
NewSessionWithOptions creates a new Cassandra session with command-line overrides.
func (*Session) AddToBatch ¶
AddToBatch adds a query to the current batch
func (*Session) CassandraVersion ¶
CassandraVersion returns the Cassandra version
func (*Session) Consistency ¶
Consistency returns the current consistency level
func (*Session) CreateBatch ¶
CreateBatch creates a new batch with the specified type
func (*Session) DBDescribeAggregate ¶
func (s *Session) DBDescribeAggregate(sessionMgr *session.Manager, aggregateName string) (interface{}, *AggregateInfo, error)
DBDescribeAggregate handles version detection and returns appropriate data
func (*Session) DBDescribeAggregates ¶
func (s *Session) DBDescribeAggregates(sessionMgr *session.Manager) (interface{}, []AggregateListInfo, error)
DBDescribeAggregates handles version detection and returns appropriate data
func (*Session) DBDescribeCluster ¶
func (s *Session) DBDescribeCluster() (interface{}, *ClusterInfo, error)
DBDescribeCluster handles version detection and returns appropriate data
func (*Session) DBDescribeFullSchema ¶ added in v0.0.11
func (s *Session) DBDescribeFullSchema(sessionMgr *session.Manager, keyspace string) (interface{}, error)
DBDescribeFullSchema returns all CREATE statements for a keyspace and its objects If keyspace is empty, returns schema for all keyspaces
func (*Session) DBDescribeFunction ¶
func (s *Session) DBDescribeFunction(sessionMgr *session.Manager, functionName string) (interface{}, []FunctionDetails, error)
DBDescribeFunction handles version detection and returns appropriate data
func (*Session) DBDescribeFunctionByName ¶ added in v0.0.11
func (s *Session) DBDescribeFunctionByName(functionName string, keyspaceName string) (interface{}, error)
DBDescribeFunctionByName returns raw query results for a function with optional keyspace
func (*Session) DBDescribeFunctions ¶
DBDescribeFunctions handles version detection and returns appropriate data
func (*Session) DBDescribeIndex ¶
func (s *Session) DBDescribeIndex(sessionMgr *session.Manager, indexName string) (interface{}, *IndexInfo, error)
DBDescribeIndex handles version detection and returns appropriate data
func (*Session) DBDescribeKeyspace ¶
func (s *Session) DBDescribeKeyspace(keyspaceName string) (interface{}, *KeyspaceInfo, error)
DBDescribeKeyspace handles version detection and returns appropriate data
func (*Session) DBDescribeKeyspaces ¶
func (s *Session) DBDescribeKeyspaces() (interface{}, []KeyspaceListInfo, error)
DBDescribeKeyspaces handles version detection and returns appropriate data
func (*Session) DBDescribeMaterializedView ¶
func (s *Session) DBDescribeMaterializedView(sessionMgr *session.Manager, viewName string) (interface{}, *MaterializedViewInfo, error)
DBDescribeMaterializedView handles version detection and returns appropriate data
func (*Session) DBDescribeMaterializedViews ¶ added in v0.0.11
DBDescribeMaterializedViews lists all materialized views
func (*Session) DBDescribeTable ¶
func (s *Session) DBDescribeTable(sessionMgr *session.Manager, tableName string) (interface{}, *TableInfo, error)
DBDescribeTable handles version detection and returns appropriate data
func (*Session) DBDescribeTables ¶
func (s *Session) DBDescribeTables(sessionMgr *session.Manager) (interface{}, []TableListInfo, error)
DBDescribeTables handles version detection and returns appropriate data
func (*Session) DBDescribeType ¶
func (s *Session) DBDescribeType(sessionMgr *session.Manager, typeName string) (interface{}, *TypeInfo, error)
DBDescribeType handles version detection and returns appropriate data
func (*Session) DBDescribeTypes ¶
func (s *Session) DBDescribeTypes(sessionMgr *session.Manager) (interface{}, []TypeListInfo, error)
DBDescribeTypes handles version detection and returns appropriate data
func (*Session) DescribeAggregateQuery ¶
func (s *Session) DescribeAggregateQuery(keyspace string, aggregateName string) (*AggregateInfo, error)
DescribeAggregateQuery executes the query to get aggregate information (for pre-4.0)
func (*Session) DescribeAggregatesQuery ¶
func (s *Session) DescribeAggregatesQuery(keyspace string) ([]AggregateListInfo, error)
DescribeAggregatesQuery executes the query to list all aggregates (for pre-4.0)
func (*Session) DescribeAllTablesQuery ¶ added in v0.0.7
func (s *Session) DescribeAllTablesQuery() ([]TableListInfo, error)
DescribeAllTablesQuery executes queries to list all tables from all keyspaces
func (*Session) DescribeClusterQuery ¶
func (s *Session) DescribeClusterQuery() (*ClusterInfo, error)
DescribeClusterQuery executes the query to get cluster information (for pre-4.0)
func (*Session) DescribeFunctionQuery ¶
func (s *Session) DescribeFunctionQuery(currentKeyspace string, functionName string) ([]FunctionDetails, error)
DescribeFunctionQuery executes the query to get detailed information about a specific function
func (*Session) DescribeFunctionsQuery ¶
DescribeFunctionsQuery executes the query to list all functions in the current keyspace (for pre-4.0)
func (*Session) DescribeIndexQuery ¶
DescribeIndexQuery executes the query to get index information (for pre-4.0)
func (*Session) DescribeIndexQueryWithTable ¶ added in v0.0.11
func (s *Session) DescribeIndexQueryWithTable(keyspace string, tableName string, indexName string) (*IndexInfo, error)
DescribeIndexQueryWithTable executes the query to get index information when table is known
func (*Session) DescribeKeyspaceQuery ¶
func (s *Session) DescribeKeyspaceQuery(keyspaceName string) (*KeyspaceInfo, error)
DescribeKeyspaceQuery executes the query to get keyspace information (for pre-4.0)
func (*Session) DescribeKeyspacesQuery ¶
func (s *Session) DescribeKeyspacesQuery() ([]KeyspaceListInfo, error)
DescribeKeyspacesQuery executes the query to list all keyspaces (for pre-4.0)
func (*Session) DescribeMaterializedViewQuery ¶
func (s *Session) DescribeMaterializedViewQuery(keyspace string, viewName string) (*MaterializedViewInfo, error)
DescribeMaterializedViewQuery executes the query to get materialized view information (for pre-4.0)
func (*Session) DescribeTableQuery ¶
DescribeTableQuery executes queries to get table information (for pre-4.0)
func (*Session) DescribeTablesQuery ¶
func (s *Session) DescribeTablesQuery(keyspace string) ([]TableListInfo, error)
DescribeTablesQuery executes queries to list all tables (for pre-4.0)
func (*Session) DescribeTypeQuery ¶
DescribeTypeQuery executes the query to get type information (for pre-4.0)
func (*Session) DescribeTypesQuery ¶
func (s *Session) DescribeTypesQuery(keyspace string) ([]TypeListInfo, error)
DescribeTypesQuery executes the query to list all types (for pre-4.0)
func (*Session) ExecuteBatch ¶
ExecuteBatch executes a batch of statements
func (*Session) ExecuteCQLQuery ¶
ExecuteCQLQuery executes a regular CQL query
func (*Session) ExecuteDMLCommand ¶
ExecuteDMLCommand executes a DML command (INSERT, UPDATE, DELETE, TRUNCATE)
func (*Session) ExecuteRoleCommand ¶
ExecuteRoleCommand executes a role-related command (CREATE/ALTER/DROP USER/ROLE, GRANT/REVOKE)
func (*Session) ExecuteSelectQuery ¶
ExecuteSelectQuery executes a SELECT query and returns formatted results
func (*Session) ExecuteStreamingQuery ¶
ExecuteStreamingQuery executes a query and returns a streaming result
func (*Session) GetColumnTypeFromSystemTable ¶ added in v0.0.5
GetColumnTypeFromSystemTable gets the full type definition for a column This method uses the metadata API when possible, falling back to system tables
func (*Session) GetCurrentKeyspaceSchema ¶
func (s *Session) GetCurrentKeyspaceSchema(sessionMgr *session.Manager) (*KeyspaceSchema, error)
GetCurrentKeyspaceSchema retrieves schema for the current keyspace
func (*Session) GetCurrentKeyspaceSchemaUsingMetadata ¶ added in v0.0.5
func (s *Session) GetCurrentKeyspaceSchemaUsingMetadata(sessionMgr *session.Manager) (*KeyspaceSchema, error)
GetCurrentKeyspaceSchemaUsingMetadata retrieves schema for the current keyspace using metadata
func (*Session) GetKeyColumns ¶
func (s *Session) GetKeyColumns(query string) map[string]KeyColumnInfo
GetKeyColumns returns information about partition and clustering columns for a table
func (*Session) GetKeyspaceMetadata ¶ added in v0.0.5
func (s *Session) GetKeyspaceMetadata(keyspace string) (*gocql.KeyspaceMetadata, error)
GetKeyspaceMetadata retrieves keyspace metadata using gocql's built-in API
func (*Session) GetKeyspaceSchema ¶
func (s *Session) GetKeyspaceSchema(keyspace string) (*KeyspaceSchema, error)
GetKeyspaceSchema retrieves schema for a specific keyspace
func (*Session) GetKeyspaceSchemaUsingMetadata ¶ added in v0.0.5
func (s *Session) GetKeyspaceSchemaUsingMetadata(keyspace string) (*KeyspaceSchema, error)
GetKeyspaceSchemaUsingMetadata retrieves keyspace schema using gocql metadata
func (*Session) GetMaterializedViewMetadata ¶ added in v0.0.5
func (s *Session) GetMaterializedViewMetadata(keyspace, viewName string) (*gocql.MaterializedViewMetadata, error)
GetMaterializedViewMetadata retrieves materialized view metadata
func (*Session) GetSchemaCache ¶
func (s *Session) GetSchemaCache() *SchemaCache
GetSchemaCache returns the schema cache
func (*Session) GetSchemaCatalog ¶
func (s *Session) GetSchemaCatalog() (*SchemaCatalog, error)
GetSchemaCatalog retrieves the complete schema catalog from Cassandra
func (*Session) GetSchemaContext ¶
GetSchemaContext returns a compact representation for AI context
func (*Session) GetTableMetadata ¶ added in v0.0.5
func (s *Session) GetTableMetadata(keyspace, table string) (*gocql.TableMetadata, error)
GetTableMetadata retrieves table metadata for a specific table
func (*Session) GetTableSchema ¶
func (s *Session) GetTableSchema(keyspace, table string) (*TableSchema, error)
GetTableSchema retrieves schema for a specific table
func (*Session) GetTableSchemaUsingMetadata ¶ added in v0.0.5
func (s *Session) GetTableSchemaUsingMetadata(keyspace, table string) (*TableSchema, error)
GetTableSchemaUsingMetadata retrieves table schema using gocql metadata
func (*Session) GetTraceData ¶
GetTraceData retrieves trace data for the last executed query
func (*Session) GetUDTRegistry ¶ added in v0.0.5
func (s *Session) GetUDTRegistry() *UDTRegistry
GetUDTRegistry returns the UDT registry
func (*Session) GetUserTypeMetadata ¶ added in v0.0.5
func (s *Session) GetUserTypeMetadata(keyspace, typeName string) (*gocql.UserTypeMetadata, error)
GetUserTypeMetadata retrieves UDT metadata for a specific type
func (*Session) IsVersion3OrHigher ¶
IsVersion3OrHigher checks if the Cassandra version is 3.0 or higher
func (*Session) IsVersion4OrHigher ¶
IsVersion4OrHigher checks if the Cassandra version is 4.0 or higher
func (*Session) ListPermissions ¶
func (s *Session) ListPermissions() ([]PermissionInfo, error)
ListPermissions queries system_auth.role_permissions for all permissions
func (*Session) ListPermissionsForRole ¶
func (s *Session) ListPermissionsForRole(roleName string) ([]PermissionInfo, error)
ListPermissionsForRole queries system_auth.role_permissions for a specific role
func (*Session) LoadKeyspaceUDTsUsingMetadata ¶ added in v0.0.5
LoadKeyspaceUDTsUsingMetadata delegates to the registry's simplified method
func (*Session) ProcessStreamingQuery ¶ added in v0.0.12
func (s *Session) ProcessStreamingQuery(result StreamingQueryResult) *StreamingResult
ProcessStreamingQuery creates a StreamingResult that loads data on demand
func (*Session) SetAutoFetch ¶ added in v0.0.9
SetAutoFetch enables or disables auto-fetching all pages
func (*Session) SetConsistency ¶
SetConsistency sets the consistency level
func (*Session) SetKeyspace ¶
SetKeyspace changes the current keyspace by recreating the session
func (*Session) SetPageSize ¶
SetPageSize sets the page size
func (*Session) SetTracing ¶
SetTracing enables or disables tracing
func (*Session) SetUDTRegistry ¶ added in v0.0.5
func (s *Session) SetUDTRegistry(registry *UDTRegistry)
SetUDTRegistry sets the UDT registry
type SessionOptions ¶
type SessionOptions struct {
Host string
Port int
Keyspace string
Username string
Password string
Consistency string // Default consistency level (e.g., "LOCAL_ONE", "QUORUM")
SSL *config.SSLConfig
BatchMode bool // Skip schema caching for batch mode
ConnectTimeout int // Connection timeout in seconds (0 = use default)
RequestTimeout int // Request timeout in seconds (0 = use default)
ConfigFile string // Path to custom config file
}
SessionOptions represents options for creating a session with command-line overrides
type StreamingProcessor ¶ added in v0.0.12
type StreamingProcessor struct {
// contains filtered or unexported fields
}
StreamingProcessor handles progressive loading and formatting of query results
func NewStreamingProcessor ¶ added in v0.0.12
func NewStreamingProcessor(result StreamingQueryResult, session *Session) *StreamingProcessor
NewStreamingProcessor creates a new streaming processor for progressive result loading
func (*StreamingProcessor) Close ¶ added in v0.0.12
func (sp *StreamingProcessor) Close() error
Close closes the iterator if it's still open
func (*StreamingProcessor) GetColumnNames ¶ added in v0.0.12
func (sp *StreamingProcessor) GetColumnNames() []string
GetColumnNames returns the raw column names (without PK/C indicators)
func (*StreamingProcessor) GetHeaders ¶ added in v0.0.12
func (sp *StreamingProcessor) GetHeaders() []string
GetHeaders returns the column headers
func (*StreamingProcessor) LoadResults ¶ added in v0.0.12
func (sp *StreamingProcessor) LoadResults(ctx context.Context, maxRows int) ([][]string, bool, error)
LoadResults loads a batch of results from the iterator Returns the formatted rows, whether more results exist, and any error
type StreamingQueryResult ¶
type StreamingQueryResult struct {
Headers []string // Column headers (with PK/C indicators)
ColumnNames []string // Original column names (for data lookup)
ColumnTypes []string // Data types of each column
ColumnTypeInfos []gocql.TypeInfo // TypeInfo objects for each column (for UDT support)
Iterator *gocql.Iter // Iterator for fetching more rows
StartTime time.Time // Query start time for duration calculation
Keyspace string // Keyspace extracted from query or session
}
StreamingQueryResult wraps query results for progressive loading
type StreamingResult ¶ added in v0.0.12
type StreamingResult struct {
Headers []string
Rows [][]string
HasMore bool
LoadMore func(ctx context.Context, count int) ([][]string, bool, error)
Close func() error
ElapsedTime time.Duration
}
StreamingResult represents a complete result that can be loaded progressively
type TableInfo ¶
type TableInfo struct {
KeyspaceName string
TableName string
TableProps map[string]interface{}
Columns []ColumnInfo
PartitionKeys []string
ClusteringKeys []string
}
TableInfo holds table information for manual describe
type TableListInfo ¶
type TableListInfo struct {
Name string
GcGrace int
Compaction map[string]string
Compression map[string]string
PartitionKeys []string
ClusteringKeys []string
}
TableListInfo holds table list information for manual describe
type TableSchema ¶
type TableSchema struct {
Keyspace string
TableName string
Columns []ColumnSchema
PartitionKeys []string
ClusteringKeys []string
}
TableSchema represents a table's schema information
type TypeListInfo ¶
type TypeListInfo struct {
Name string
}
TypeListInfo holds type list information for manual describe
type UDTDefinition ¶ added in v0.0.5
UDTDefinition represents a complete User-Defined Type definition
func (*UDTDefinition) GetFieldByName ¶ added in v0.0.5
func (d *UDTDefinition) GetFieldByName(name string) (*UDTField, int, error)
GetFieldByName returns a field by name from the UDT definition
func (*UDTDefinition) String ¶ added in v0.0.5
func (d *UDTDefinition) String() string
String returns a string representation of a UDT definition
type UDTField ¶ added in v0.0.5
type UDTField struct {
Name string
TypeStr string
TypeInfo *CQLTypeInfo // Parsed type information
}
UDTField represents a field within a User-Defined Type
type UDTRegistry ¶ added in v0.0.5
type UDTRegistry struct {
// contains filtered or unexported fields
}
UDTRegistry manages UDT definitions using gocql's cached metadata This simplified version relies on gocql's internal caching instead of maintaining our own cache
func NewUDTRegistry ¶ added in v0.0.5
func NewUDTRegistry(session *gocql.Session) *UDTRegistry
NewUDTRegistry creates a new UDT registry with the given session
func (*UDTRegistry) Clear ¶ added in v0.0.5
func (r *UDTRegistry) Clear()
Clear is a no-op since we don't maintain our own cache gocql's cache is managed internally
func (*UDTRegistry) ClearKeyspace ¶ added in v0.0.5
func (r *UDTRegistry) ClearKeyspace(keyspace string)
ClearKeyspace is a no-op since we don't maintain our own cache
func (*UDTRegistry) GetAllUDTs ¶ added in v0.0.5
func (r *UDTRegistry) GetAllUDTs(keyspace string) map[string]*UDTDefinition
GetAllUDTs returns all UDT definitions for a keyspace from gocql's cached metadata
func (*UDTRegistry) GetUDTDefinition ¶ added in v0.0.5
func (r *UDTRegistry) GetUDTDefinition(keyspace, udtName string) (*UDTDefinition, error)
GetUDTDefinition retrieves a UDT definition from gocql's cached metadata
func (*UDTRegistry) GetUDTDefinitionOrLoad ¶ added in v0.0.5
func (r *UDTRegistry) GetUDTDefinitionOrLoad(keyspace, udtName string) (*UDTDefinition, error)
GetUDTDefinitionOrLoad is now just an alias for GetUDTDefinition since gocql handles the loading and caching internally
func (*UDTRegistry) HasUDT ¶ added in v0.0.5
func (r *UDTRegistry) HasUDT(keyspace, udtName string) bool
HasUDT checks if a UDT exists in the keyspace
func (*UDTRegistry) LoadKeyspaceUDTs ¶ added in v0.0.5
func (r *UDTRegistry) LoadKeyspaceUDTs(keyspace string) error
LoadKeyspaceUDTs is now a no-op since gocql handles loading automatically Kept for backward compatibility
func (*UDTRegistry) LoadKeyspaceUDTsUsingMetadata ¶ added in v0.0.5
func (r *UDTRegistry) LoadKeyspaceUDTsUsingMetadata(keyspace string) error
LoadKeyspaceUDTsUsingMetadata is now a no-op since we always use metadata Kept for backward compatibility
Source Files
¶
- db.go
- describe_aggregate.go
- describe_cluster.go
- describe_functions.go
- describe_index.go
- describe_keyspace.go
- describe_mv.go
- describe_schema.go
- describe_table.go
- describe_type.go
- dml_commands.go
- executor.go
- format_table.go
- metadata.go
- query_result.go
- raw_bytes.go
- role_commands.go
- schema.go
- schema_cache.go
- streaming_processor.go
- type_parser.go
- types.go
- udt_decoder.go
- udt_schema.go