parser

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2021 License: Apache-2.0 Imports: 7 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.NewSetType(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.Varchar},
		{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.NewSetType(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.NewMapType(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.NewListType(datatype.Varchar)},
		{Keyspace: "system", Table: "schema_usertypes", Name: "field_types", Type: datatype.NewListType(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 IsCountStarQuery

func IsCountStarQuery(stmt *SelectStatement) bool

func Parse

func Parse(keyspace string, query string) (handled bool, idempotent bool, stmt interface{})

Types

type AliasSelector

type AliasSelector struct {
	Selector interface{}
	Alias    string
}

type CountStarSelector

type CountStarSelector struct {
	Name string
}

type ErrorSelectStatement

type ErrorSelectStatement struct {
	Err error
}

type IDSelector

type IDSelector struct {
	Name string
}

type SelectStatement

type SelectStatement struct {
	Table     string
	Selectors []interface{}
}

type StarSelector

type StarSelector struct{}

type UseStatement

type UseStatement struct {
	Keyspace string
}

type ValueLookupFunc

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

Jump to

Keyboard shortcuts

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