parser

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 25, 2025 License: Apache-2.0 Imports: 6 Imported by: 2

Documentation

Index

Constants

View Source
const (
	CountValueName = "count(*)"
)

Variables

View Source
var (
	SystemLocalColumns = []*message.ColumnMetadata{
		{Keyspace: "system", Table: "local", Name: "key", Type: datatype.Varchar},
		{Keyspace: "system", Table: "local", Name: "rpc_address", Type: datatype.Inet},
		{Keyspace: "system", Table: "local", Name: "data_center", Type: datatype.Varchar},
		{Keyspace: "system", Table: "local", Name: "rack", Type: datatype.Varchar},
		{Keyspace: "system", Table: "local", Name: "tokens", Type: datatype.NewSet(datatype.Varchar)},
		{Keyspace: "system", Table: "local", Name: "release_version", Type: datatype.Varchar},
		{Keyspace: "system", Table: "local", Name: "partitioner", Type: datatype.Varchar},
		{Keyspace: "system", Table: "local", Name: "cluster_name", Type: datatype.Varchar},
		{Keyspace: "system", Table: "local", Name: "cql_version", Type: datatype.Varchar},
		{Keyspace: "system", Table: "local", Name: "schema_version", Type: datatype.Uuid},
		{Keyspace: "system", Table: "local", Name: "native_protocol_version", Type: datatype.Varchar},
		{Keyspace: "system", Table: "local", Name: "host_id", Type: datatype.Uuid},
	}

	DseSystemLocalColumns = []*message.ColumnMetadata{
		{Keyspace: "system", Table: "local", Name: "key", Type: datatype.Varchar},
		{Keyspace: "system", Table: "local", Name: "rpc_address", Type: datatype.Inet},
		{Keyspace: "system", Table: "local", Name: "data_center", Type: datatype.Varchar},

		{Keyspace: "system", Table: "local", Name: "dse_version", Type: datatype.Varchar},
		{Keyspace: "system", Table: "local", Name: "rack", Type: datatype.Varchar},
		{Keyspace: "system", Table: "local", Name: "tokens", Type: datatype.NewSet(datatype.Varchar)},
		{Keyspace: "system", Table: "local", Name: "release_version", Type: datatype.Varchar},
		{Keyspace: "system", Table: "local", Name: "partitioner", Type: datatype.Varchar},
		{Keyspace: "system", Table: "local", Name: "cluster_name", Type: datatype.Varchar},
		{Keyspace: "system", Table: "local", Name: "cql_version", Type: datatype.Varchar},
		{Keyspace: "system", Table: "local", Name: "schema_version", Type: datatype.Uuid},
		{Keyspace: "system", Table: "local", Name: "native_protocol_version", Type: datatype.Varchar},
		{Keyspace: "system", Table: "local", Name: "host_id", Type: datatype.Uuid},
	}

	SystemPeersColumns = []*message.ColumnMetadata{
		{Keyspace: "system", Table: "peers", Name: "peer", Type: datatype.Inet},
		{Keyspace: "system", Table: "peers", Name: "rpc_address", Type: datatype.Inet},
		{Keyspace: "system", Table: "peers", Name: "data_center", Type: datatype.Varchar},
		{Keyspace: "system", Table: "peers", Name: "rack", Type: datatype.Varchar},
		{Keyspace: "system", Table: "peers", Name: "tokens", Type: datatype.NewSet(datatype.Varchar)},
		{Keyspace: "system", Table: "peers", Name: "release_version", Type: datatype.Varchar},
		{Keyspace: "system", Table: "peers", Name: "schema_version", Type: datatype.Uuid},
		{Keyspace: "system", Table: "peers", Name: "host_id", Type: datatype.Uuid},
	}

	DseSystemPeersColumns = []*message.ColumnMetadata{
		{Keyspace: "system", Table: "peers", Name: "peer", Type: datatype.Inet},
		{Keyspace: "system", Table: "peers", Name: "rpc_address", Type: datatype.Inet},
		{Keyspace: "system", Table: "peers", Name: "data_center", Type: datatype.Varchar},
		{Keyspace: "system", Table: "peers", Name: "dse_version", Type: datatype.Varchar},
		{Keyspace: "system", Table: "peers", Name: "rack", Type: datatype.Varchar},
		{Keyspace: "system", Table: "peers", Name: "tokens", Type: datatype.NewSet(datatype.Varchar)},
		{Keyspace: "system", Table: "peers", Name: "release_version", Type: datatype.Varchar},
		{Keyspace: "system", Table: "peers", Name: "schema_version", Type: datatype.Uuid},
		{Keyspace: "system", Table: "peers", Name: "host_id", Type: datatype.Uuid},
	}

	SystemSchemaKeyspaces = []*message.ColumnMetadata{
		{Keyspace: "system", Table: "schema_keyspaces", Name: "keyspace_name", Type: datatype.Varchar},
		{Keyspace: "system", Table: "schema_keyspaces", Name: "durable_writes", Type: datatype.Boolean},
		{Keyspace: "system", Table: "schema_keyspaces", Name: "strategy_class", Type: datatype.Varchar},
		{Keyspace: "system", Table: "schema_keyspaces", Name: "strategy_options", Type: datatype.Varchar},
	}

	SystemSchemaColumnFamilies = []*message.ColumnMetadata{
		{Keyspace: "system", Table: "schema_columnfamilies", Name: "keyspace_name", Type: datatype.Varchar},
		{Keyspace: "system", Table: "schema_columnfamilies", Name: "columnfamily_name", Type: datatype.Varchar},
		{Keyspace: "system", Table: "schema_columnfamilies", Name: "bloom_filter_fp_chance", Type: datatype.Double},
		{Keyspace: "system", Table: "schema_columnfamilies", Name: "caching", Type: datatype.Varchar},
		{Keyspace: "system", Table: "schema_columnfamilies", Name: "cf_id", Type: datatype.Uuid},
		{Keyspace: "system", Table: "schema_columnfamilies", Name: "comment", Type: datatype.Varchar},
		{Keyspace: "system", Table: "schema_columnfamilies", Name: "compaction_strategy_class", Type: datatype.Varchar},
		{Keyspace: "system", Table: "schema_columnfamilies", Name: "compaction_strategy_options", Type: datatype.Varchar},
		{Keyspace: "system", Table: "schema_columnfamilies", Name: "comparator", Type: datatype.Varchar},
		{Keyspace: "system", Table: "schema_columnfamilies", Name: "compression_parameters", Type: datatype.Varchar},
		{Keyspace: "system", Table: "schema_columnfamilies", Name: "default_time_to_live", Type: datatype.Int},
		{Keyspace: "system", Table: "schema_columnfamilies", Name: "default_validator", Type: datatype.Varchar},
		{Keyspace: "system", Table: "schema_columnfamilies", Name: "dropped_columns", Type: datatype.NewMap(datatype.Varchar, datatype.Bigint)},
		{Keyspace: "system", Table: "schema_columnfamilies", Name: "gc_grace_seconds", Type: datatype.Int},
		{Keyspace: "system", Table: "schema_columnfamilies", Name: "is_dense", Type: datatype.Boolean},
		{Keyspace: "system", Table: "schema_columnfamilies", Name: "key_validator", Type: datatype.Varchar},
		{Keyspace: "system", Table: "schema_columnfamilies", Name: "local_read_repair_chance", Type: datatype.Double},
		{Keyspace: "system", Table: "schema_columnfamilies", Name: "max_compaction_threshold", Type: datatype.Int},
		{Keyspace: "system", Table: "schema_columnfamilies", Name: "max_index_interval", Type: datatype.Int},
		{Keyspace: "system", Table: "schema_columnfamilies", Name: "memtable_flush_period_in_ms", Type: datatype.Int},
		{Keyspace: "system", Table: "schema_columnfamilies", Name: "min_compaction_threshold", Type: datatype.Int},
		{Keyspace: "system", Table: "schema_columnfamilies", Name: "min_index_interval", Type: datatype.Int},
		{Keyspace: "system", Table: "schema_columnfamilies", Name: "read_repair_chance", Type: datatype.Double},
		{Keyspace: "system", Table: "schema_columnfamilies", Name: "speculative_retry", Type: datatype.Varchar},
		{Keyspace: "system", Table: "schema_columnfamilies", Name: "subcomparator", Type: datatype.Varchar},
		{Keyspace: "system", Table: "schema_columnfamilies", Name: "type", Type: datatype.Varchar},
	}

	SystemSchemaColumns = []*message.ColumnMetadata{
		{Keyspace: "system", Table: "schema_columns", Name: "keyspace_name", Type: datatype.Varchar},
		{Keyspace: "system", Table: "schema_columns", Name: "columnfamily_name", Type: datatype.Varchar},
		{Keyspace: "system", Table: "schema_columns", Name: "column_name", Type: datatype.Varchar},
		{Keyspace: "system", Table: "schema_columns", Name: "component_index", Type: datatype.Int},
		{Keyspace: "system", Table: "schema_columns", Name: "index_name", Type: datatype.Varchar},
		{Keyspace: "system", Table: "schema_columns", Name: "index_options", Type: datatype.Varchar},
		{Keyspace: "system", Table: "schema_columns", Name: "index_type", Type: datatype.Varchar},
		{Keyspace: "system", Table: "schema_columns", Name: "type", Type: datatype.Varchar},
		{Keyspace: "system", Table: "schema_columns", Name: "validator", Type: datatype.Varchar},
	}

	SystemSchemaUsertypes = []*message.ColumnMetadata{
		{Keyspace: "system", Table: "schema_usertypes", Name: "keyspace_name", Type: datatype.Varchar},
		{Keyspace: "system", Table: "schema_usertypes", Name: "type_name", Type: datatype.Varchar},
		{Keyspace: "system", Table: "schema_usertypes", Name: "field_names", Type: datatype.NewList(datatype.Varchar)},
		{Keyspace: "system", Table: "schema_usertypes", Name: "field_types", Type: datatype.NewList(datatype.Varchar)},
	}
)
View Source
var SystemColumnsByName = map[string][]*message.ColumnMetadata{
	"local":                 SystemLocalColumns,
	"peers":                 SystemPeersColumns,
	"schema_keyspaces":      SystemSchemaKeyspaces,
	"schema_columnfamilies": SystemSchemaColumnFamilies,
	"schema_columns":        SystemSchemaColumns,
	"schema_usertypes":      SystemSchemaUsertypes,
}

Functions

func FilterColumns

func FilterColumns(stmt *SelectStatement, columns []*message.ColumnMetadata) (filtered []*message.ColumnMetadata, err error)

func FilterValues

func FilterValues(stmt *SelectStatement, columns []*message.ColumnMetadata, valueFunc ValueLookupFunc) (filtered []message.Column, err error)

func FindColumnMetadata

func FindColumnMetadata(columns []*message.ColumnMetadata, name string) *message.ColumnMetadata

func IsQueryIdempotent added in v0.1.0

func IsQueryIdempotent(query string) (idempotent bool, err error)

IsQueryIdempotent parses the query string and determines if the query is idempotent

Types

type AliasSelector

type AliasSelector struct {
	Selector Selector
	Alias    string
}

func (AliasSelector) Columns added in v0.2.0

func (a AliasSelector) Columns(columns []*message.ColumnMetadata, stmt *SelectStatement) (filtered []*message.ColumnMetadata, err error)

func (AliasSelector) Values added in v0.2.0

func (a AliasSelector) Values(columns []*message.ColumnMetadata, valueFunc ValueLookupFunc) (filtered []message.Column, err error)

type CountFuncSelector added in v0.2.0

type CountFuncSelector struct {
	Arg string
}

func (CountFuncSelector) Columns added in v0.2.0

func (s CountFuncSelector) Columns(_ []*message.ColumnMetadata, stmt *SelectStatement) (filtered []*message.ColumnMetadata, err error)

func (CountFuncSelector) Values added in v0.2.0

func (s CountFuncSelector) Values(_ []*message.ColumnMetadata, valueFunc ValueLookupFunc) (filtered []message.Column, err error)

type IDSelector

type IDSelector struct {
	Name string
}

func (IDSelector) Columns added in v0.2.0

func (i IDSelector) Columns(columns []*message.ColumnMetadata, stmt *SelectStatement) (filtered []*message.ColumnMetadata, err error)

func (IDSelector) Values added in v0.2.0

func (i IDSelector) Values(_ []*message.ColumnMetadata, valueFunc ValueLookupFunc) (filtered []message.Column, err error)

type Identifier added in v0.1.0

type Identifier struct {
	// contains filtered or unexported fields
}

Identifier is a CQL identifier

func IdentifierFromString added in v0.1.0

func IdentifierFromString(id string) Identifier

IdentifierFromString creates an identifier from a string

func (Identifier) ID added in v0.1.6

func (i Identifier) ID() string

func (Identifier) String added in v0.1.6

func (i Identifier) String() string

type NowFuncSelector added in v0.2.0

type NowFuncSelector struct{}

func (NowFuncSelector) Columns added in v0.2.0

func (s NowFuncSelector) Columns(_ []*message.ColumnMetadata, stmt *SelectStatement) (filtered []*message.ColumnMetadata, err error)

func (NowFuncSelector) Values added in v0.2.0

func (s NowFuncSelector) Values(_ []*message.ColumnMetadata, _ ValueLookupFunc) (filtered []message.Column, err error)

type SelectStatement

type SelectStatement struct {
	Keyspace  string
	Table     string
	Selectors []Selector
}

type Selector added in v0.1.0

type Selector interface {
	Values(columns []*message.ColumnMetadata, valueFunc ValueLookupFunc) (filtered []message.Column, err error)
	Columns(columns []*message.ColumnMetadata, stmt *SelectStatement) (filtered []*message.ColumnMetadata, err error)
}

type StarSelector

type StarSelector struct{}

func (StarSelector) Columns added in v0.2.0

func (s StarSelector) Columns(columns []*message.ColumnMetadata, _ *SelectStatement) (filtered []*message.ColumnMetadata, err error)

func (StarSelector) Values added in v0.2.0

func (s StarSelector) Values(columns []*message.ColumnMetadata, valueFunc ValueLookupFunc) (filtered []message.Column, err error)

type Statement added in v0.1.0

type Statement interface {
	// contains filtered or unexported methods
}

func IsQueryHandled added in v0.1.0

func IsQueryHandled(keyspace Identifier, query string) (handled bool, stmt Statement, err error)

IsQueryHandled parses the query string and determines if the query is handled by the proxy

type UseStatement

type UseStatement struct {
	Keyspace string
}

type ValueLookupFunc

type ValueLookupFunc func(name string) (value message.Column, err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL