Documentation ¶
Index ¶
- Constants
- Variables
- func NewConnectionOptions() connectionOptions
- func NewQueueOptions() queueOptions
- func NewRequestOptions() requestOptions
- func Set(val interface{}) setmarker
- type CassType
- type Cluster
- func (cluster *Cluster) Close()
- func (cluster *Cluster) Connect() (*Session, error)
- func (cluster *Cluster) SetConnectionOptions(opts connectionOptions) error
- func (cluster *Cluster) SetConnectionTimeout(timeout time.Duration)
- func (cluster *Cluster) SetProtocolVersion(version uint8)
- func (cluster *Cluster) SetQueueOptions(opts queueOptions) error
- func (cluster *Cluster) SetRequestOptions(opts requestOptions) error
- func (cluster *Cluster) SetRequestTimeout(timeout time.Duration)
- func (cluster *Cluster) SetUseSchemaMetadata(flag bool)
- type Consistency
- type Date
- type Decimal
- type Future
- type PreparedStatement
- func (pstmt *PreparedStatement) Close()
- func (pstmt *PreparedStatement) Exec(args ...interface{}) (*Rows, error)
- func (pstmt *PreparedStatement) ExecAsync(args ...interface{}) *Future
- func (pstmt *PreparedStatement) Query(args ...interface{}) (*Statement, error)
- func (pstmt *PreparedStatement) SetConsistency(c Consistency)
- func (pstmt *PreparedStatement) SetSerialConsistency(c Consistency)
- type Rows
- type Session
- func (session *Session) Close()
- func (session *Session) Exec(query string, args ...interface{}) (*Rows, error)
- func (session *Session) ExecAsync(query string, args ...interface{}) *Future
- func (session *Session) Prepare(query string) (*PreparedStatement, error)
- func (session *Session) Query(query string, args ...interface{}) (*Statement, error)
- type Statement
- type Time
- type Timestamp
- type Tuple
- func (tuple Tuple) Get(index int) interface{}
- func (tuple Tuple) Kind() CassType
- func (tuple Tuple) Len() int
- func (tuple Tuple) NativeString() string
- func (tuple *Tuple) Set(index int, value interface{}) *Tuple
- func (tuple *Tuple) SetValues(values ...interface{}) error
- func (tuple Tuple) String() string
- func (tuple Tuple) Values() []interface{}
- type UUID
Constants ¶
const ( CASS_VALUE_TYPE_UNKNOWN = 0xFFFF CASS_VALUE_TYPE_CUSTOM = 0x0000 CASS_VALUE_TYPE_ASCII = 0x0001 CASS_VALUE_TYPE_BIGINT = 0x0002 CASS_VALUE_TYPE_BLOB = 0x0003 CASS_VALUE_TYPE_BOOLEAN = 0x0004 CASS_VALUE_TYPE_COUNTER = 0x0005 CASS_VALUE_TYPE_DECIMAL = 0x0006 CASS_VALUE_TYPE_DOUBLE = 0x0007 CASS_VALUE_TYPE_FLOAT = 0x0008 CASS_VALUE_TYPE_INT = 0x0009 CASS_VALUE_TYPE_TEXT = 0x000A CASS_VALUE_TYPE_TIMESTAMP = 0x000B CASS_VALUE_TYPE_UUID = 0x000C CASS_VALUE_TYPE_VARCHAR = 0x000D CASS_VALUE_TYPE_VARINT = 0x000E CASS_VALUE_TYPE_TIMEUUID = 0x000F CASS_VALUE_TYPE_INET = 0x0010 CASS_VALUE_TYPE_DATE = 0x0011 CASS_VALUE_TYPE_TIME = 0x0012 CASS_VALUE_TYPE_SMALL_INT = 0x0013 CASS_VALUE_TYPE_TINY_INT = 0x0014 CASS_VALUE_TYPE_LIST = 0x0020 CASS_VALUE_TYPE_MAP = 0x0021 CASS_VALUE_TYPE_SET = 0x0022 CASS_VALUE_TYPE_UDT = 0x0030 CASS_VALUE_TYPE_TUPLE = 0x0031 )
Variables ¶
var ( CUnknown = newCassType(CASS_VALUE_TYPE_UNKNOWN) CAscii = newCassType(CASS_VALUE_TYPE_ASCII) CBigInt = newCassType(CASS_VALUE_TYPE_BIGINT) CBlob = newCassType(CASS_VALUE_TYPE_BLOB) CBoolean = newCassType(CASS_VALUE_TYPE_BOOLEAN) CDecimal = newCassType(CASS_VALUE_TYPE_DECIMAL) CDouble = newCassType(CASS_VALUE_TYPE_DOUBLE) CFloat = newCassType(CASS_VALUE_TYPE_FLOAT) CInt = newCassType(CASS_VALUE_TYPE_INT) CText = newCassType(CASS_VALUE_TYPE_TEXT) CTimestamp = newCassType(CASS_VALUE_TYPE_TIMESTAMP) CUuid = newCassType(CASS_VALUE_TYPE_UUID) CVarchar = newCassType(CASS_VALUE_TYPE_VARCHAR) CVarint = newCassType(CASS_VALUE_TYPE_VARINT) CTimeuuid = newCassType(CASS_VALUE_TYPE_TIMEUUID) CInet = newCassType(CASS_VALUE_TYPE_INET) CDate = newCassType(CASS_VALUE_TYPE_DATE) CTime = newCassType(CASS_VALUE_TYPE_TIME) CSmallInt = newCassType(CASS_VALUE_TYPE_SMALL_INT) CTinyInt = newCassType(CASS_VALUE_TYPE_TINY_INT) // collections CList = newCassType(CASS_VALUE_TYPE_LIST) CSet = newCassType(CASS_VALUE_TYPE_SET) CMap = newCassType(CASS_VALUE_TYPE_MAP) CTuple = newCassType(CASS_VALUE_TYPE_TUPLE) CUdt = newCassType(CASS_VALUE_TYPE_UDT) )
Predefined CassTypes for all known Cassandra data types.
var Epoch = time.Date(1970, 1, 1, 0, 0, 0, 0, time.UTC)
Functions ¶
func NewConnectionOptions ¶
func NewConnectionOptions() connectionOptions
Configure only the settings that are of interest. The rest will use the defaults.
func NewQueueOptions ¶
func NewQueueOptions() queueOptions
func NewRequestOptions ¶
func NewRequestOptions() requestOptions
Types ¶
type CassType ¶
type CassType struct {
// contains filtered or unexported fields
}
A CassType represents a specific Cassandra data type. Collection types (list, set, map, tuple, UDTs) have subtypes specifying the data type of their elements.
func (CassType) Specialize ¶
Specialize a collection type (list, set, map, tuple) with the type(s) of its elements
type Cluster ¶
type Cluster struct {
// contains filtered or unexported fields
}
func NewCluster ¶
func (*Cluster) SetConnectionOptions ¶
func (*Cluster) SetConnectionTimeout ¶
func (*Cluster) SetProtocolVersion ¶
func (*Cluster) SetQueueOptions ¶
func (*Cluster) SetRequestOptions ¶
func (*Cluster) SetRequestTimeout ¶
func (*Cluster) SetUseSchemaMetadata ¶
Disable retrieving and updating schema metadata. When disabled, the cluster initialization is faster, but this also disables the token-aware routing of requests
type Consistency ¶
type Consistency int
const ( ANY Consistency ONE TWO THREE QUORUM ALL LOCAL_QUORUM EACH_QUORUM // Serial Consistency SERIAL LOCAL_SERIAL LOCAL_ONE )
type Date ¶
type Date struct {
// contains filtered or unexported fields
}
Cassandra Date is a 32-bit unsigned integer representing the number of days with Epoch (1970-1-1) at the center of the range
func ParseDate ¶
Creates a new Date value from the string representation. The accepted formats are: * yyyy-mm-dd * yyyy-m-d * yyyy-mm-d * yyyy-m-dd If the value cannot be parsed to a valid date, this function return a non-nil error
func (Date) NativeString ¶
Returns a representation that can be used directly in CQL
type Decimal ¶
A Decimal type corresponding to the Cassandra decimal data type. The internal representation of the decimal is an arbitrary precision integer unscaled balue and a 32-bit integer scale. Thus the value is equal to (unscaled * 10 ^ (-scale))
func NewDecimal ¶
func ParseDecimal ¶
func (Decimal) NativeString ¶
type PreparedStatement ¶
type PreparedStatement struct {
// contains filtered or unexported fields
}
func (*PreparedStatement) Close ¶
func (pstmt *PreparedStatement) Close()
func (*PreparedStatement) Exec ¶
func (pstmt *PreparedStatement) Exec(args ...interface{}) (*Rows, error)
func (*PreparedStatement) ExecAsync ¶
func (pstmt *PreparedStatement) ExecAsync(args ...interface{}) *Future
func (*PreparedStatement) Query ¶
func (pstmt *PreparedStatement) Query(args ...interface{}) (*Statement, error)
func (*PreparedStatement) SetConsistency ¶
func (pstmt *PreparedStatement) SetConsistency(c Consistency)
func (*PreparedStatement) SetSerialConsistency ¶
func (pstmt *PreparedStatement) SetSerialConsistency(c Consistency)
type Rows ¶
type Rows struct {
// contains filtered or unexported fields
}
func (*Rows) ColumnCount ¶
func (*Rows) ColumnName ¶
func (*Rows) ColumnType ¶
type Session ¶
type Session struct { Cluster *Cluster // contains filtered or unexported fields }
type Statement ¶
type Statement struct { Args []interface{} // contains filtered or unexported fields }
func (*Statement) WithConsistency ¶
func (stmt *Statement) WithConsistency(c Consistency) *Statement
func (*Statement) WithSerialConsistency ¶
func (stmt *Statement) WithSerialConsistency(c Consistency) *Statement
type Time ¶
type Time int64
Cassandra `time` type represents a time of day with no date (and no notion of time zone)
func (Time) Nanoseconds ¶
func (Time) NativeString ¶
type Timestamp ¶
type Timestamp struct {
// contains filtered or unexported fields
}
Cassandra `timestamp` represents a date plus time, encoded as 8 bytes since epoch
func NewTimestamp ¶
func NewTimestampFromTime ¶
func (Timestamp) NativeString ¶
type Tuple ¶
type Tuple struct {
// contains filtered or unexported fields
}
A Tuple type corresponding to the Cassandra tuple data type.
func (Tuple) NativeString ¶
type UUID ¶
type UUID [16]byte
Used to represent both a Cassandra `uuid` (UUID v4) and `timeuuid` (UUID v1).
Inspired by: * https://github.com/satori/go.uuid * https://github.com/pborman/uuid