Documentation ¶
Index ¶
- func GetSession(cluster ClusterDriver) (*driver.Session, error)
- type ClusterDriver
- type ColumnComparator
- func (cc ColumnComparator) Eq() ColumnComparator
- func (cc ColumnComparator) Gt() ColumnComparator
- func (cc ColumnComparator) GtOrEq() ColumnComparator
- func (cc ColumnComparator) In() ColumnComparator
- func (cc ColumnComparator) Lt() ColumnComparator
- func (cc ColumnComparator) LtOrEq() ColumnComparator
- type Keyspace
- type KeyspaceConfig
- type SelectParams
- type Table
- func (t *Table) AsyncInsert(dataStruct interface{}) <-chan error
- func (t *Table) Column(columnName string) (string, error)
- func (t *Table) Columns() []string
- func (t *Table) ColumnsWithDataType() [][]string
- func (t *Table) Definition() *map[string]TableColumn
- func (t *Table) FullName() string
- func (t *Table) Keyspace() *Keyspace
- func (t *Table) Name() string
- func (t *Table) Schema() *map[string]string
- func (t *Table) Select(p SelectParams) (interface{}, error)
- func (t *Table) Session() driver.SessionI
- type TableColumn
- type TableConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetSession ¶
func GetSession(cluster ClusterDriver) (*driver.Session, error)
GetSession creates new GoCql connection if required, and returns the existing or newly creating session. The returned Session is a Singleton.
Types ¶
type ClusterDriver ¶
ClusterDriver is the implementation for Cassandra-driver.
type ColumnComparator ¶
type ColumnComparator struct { Name string Value interface{} // contains filtered or unexported fields }
ColumnComparator Creates comparator for select queries
func Comparator ¶ added in v1.2.0
func Comparator(col string, value interface{}) ColumnComparator
Comparator is a convenience function to create a new ColumnComparator
func (ColumnComparator) Eq ¶
func (cc ColumnComparator) Eq() ColumnComparator
Eq creates an Equality (=) operator
func (ColumnComparator) Gt ¶
func (cc ColumnComparator) Gt() ColumnComparator
Gt creates a Greater-Than (>) operator
func (ColumnComparator) GtOrEq ¶
func (cc ColumnComparator) GtOrEq() ColumnComparator
GtOrEq creates a Greater-Than-Or-Equals-To (>=) operator
func (ColumnComparator) In ¶
func (cc ColumnComparator) In() ColumnComparator
In creates a Value-In-Array operator. The provided value must be an array.
func (ColumnComparator) Lt ¶
func (cc ColumnComparator) Lt() ColumnComparator
Lt creates a Less-Than (<) operator
func (ColumnComparator) LtOrEq ¶
func (cc ColumnComparator) LtOrEq() ColumnComparator
LtOrEq creates a Less-Than-Or-Equals-To (<=) operator
type Keyspace ¶
type Keyspace struct {
// contains filtered or unexported fields
}
Keyspace acts as utility-entity corresponding to Cassandra Keyspace.
func NewKeyspace ¶
func NewKeyspace(session driver.SessionI, kc KeyspaceConfig) (*Keyspace, error)
NewKeyspace creates a new Keyspace-entity instance, and also creates the Keyspace in database if it doesn't exist.
func (*Keyspace) Alter ¶
Alter allows changing replicationStrategy and replicationFactor of Keyspace.
func (*Keyspace) ReplicationStrategy ¶
ReplicationStrategy returns the replicationStrategy of Keyspace.
func (*Keyspace) ReplicationStrategyArgs ¶
ReplicationStrategyArgs returns the ReplicationStrategyArgs of Keyspace.
type KeyspaceConfig ¶
type KeyspaceConfig struct { Name string ReplicationStrategy string ReplicationStrategyArgs map[string]int }
KeyspaceConfig defines configuration for Keyspace.
type SelectParams ¶
type SelectParams struct { ColumnValues []ColumnComparator // Add LIMIT parameter to the query Limit uint PageSize uint // This should be the pointer to a struct slice representing the // returned data. The results are loaded into provided slice. ResultsBind interface{} // The columns to add in SELECT statement SelectColumns []string }
SelectParams defines parameters for a SELECT query.
type Table ¶
type Table struct {
// contains filtered or unexported fields
}
Table contains functions to help interact with table, which was created using the provided definition.
func NewTable ¶
func NewTable( session driver.SessionI, tc *TableConfig, definition *map[string]TableColumn, ) (*Table, error)
NewTable creates a new table in database (if a table doesn't exist). This always returns table-structures as per provided definition, even if the table already existed in database (in which case the provided-definition is still not cross-checked/synced with the actual table from database).
func (*Table) AsyncInsert ¶
AsyncInsert asynchronously inserts the specified data into table.
func (*Table) Column ¶
Column returns the column-name (as used in database) from specified common-name of column. Use this for referencing columns in table. Returns error if no column matching the provided common-name is found.
func (*Table) ColumnsWithDataType ¶
ColumnsWithDataType returns a two-dimensional slice containing column-name and data-type pairs.
func (*Table) Definition ¶
func (t *Table) Definition() *map[string]TableColumn
Definition is the table detailed-structure, used to create the table and form its schema.
func (*Table) Keyspace ¶
Keyspace returns the table keyspace as specified when creating new table. This can only be set when #NewTable function is called.
func (*Table) Schema ¶
Schema returns table-schema exactly as represented in database. This can be used to create the table in database.
func (*Table) Select ¶
func (t *Table) Select(p SelectParams) (interface{}, error)
Select gets data from table. This returns a slice of struct containing the returned data. This slice is same as specified in SelectParams.ResultsBind
type TableColumn ¶
type TableColumn struct { Name string DataType string PrimaryKeyIndex string PrimaryKeyOrder string }
TableColumn represents column-definition for database.
type TableConfig ¶
TableConfig defines configuration for Table.