Documentation ¶
Index ¶
- Constants
- Variables
- type Compression
- type Consistency
- type DebugLogger
- type DefaultLogger
- type EventType
- type Iter
- type Query
- func (q *Query) AsyncExec(ctx context.Context)
- func (q *Query) Bind(pos int, v Serializable) *Query
- func (q *Query) BindInt64(pos int, v int64) *Query
- func (q *Query) Compression() bool
- func (q *Query) Exec(ctx context.Context) (Result, error)
- func (q *Query) Fetch() (Result, error)
- func (q *Query) Idempotent() bool
- func (q *Query) Iter(ctx context.Context) Iter
- func (q *Query) NoSkipMetadata() *Query
- func (q *Query) PageSize() int32
- func (q *Query) PageState() []byte
- func (q *Query) Prepare(ctx context.Context) error
- func (q *Query) RetryPolicy() transport.RetryPolicy
- func (q *Query) SerialConsistency(v frame.Consistency) frame.Consistency
- func (q *Query) SetCompression(v bool)
- func (q *Query) SetIdempotent(v bool)
- func (q *Query) SetPageSize(v int32)
- func (q *Query) SetPageState(v []byte)
- func (q *Query) SetRetryPolicy(v transport.RetryPolicy) *Query
- func (q *Query) SetSerialConsistency(v frame.Consistency)
- type Result
- type Serializable
- type Session
- func (s *Session) AwaitSchemaAgreement(ctx context.Context, timeout time.Duration) error
- func (s *Session) CheckSchemaAgreement(ctx context.Context) (bool, error)
- func (s *Session) Close()
- func (s *Session) Closed() bool
- func (s *Session) NewTokenAwareDCAwarePolicy(localDC string) transport.HostSelectionPolicy
- func (s *Session) NewTokenAwarePolicy() transport.HostSelectionPolicy
- func (s *Session) Prepare(ctx context.Context, content string) (Query, error)
- func (s *Session) Query(content string) Query
- type SessionConfig
Constants ¶
View Source
const ( // ErrCodeServer indicates unexpected error on server-side. // See https://github.com/apache/cassandra/blob/adcff3f630c0d07d1ba33bf23fcb11a6db1b9af1/doc/native_protocol_v4.spec#L1051-L1052 ErrCodeServer frame.ErrorCode = 0x0000 // ErrCodeProtocol indicates a protocol violation by some client message. // See https://github.com/apache/cassandra/blob/adcff3f630c0d07d1ba33bf23fcb11a6db1b9af1/doc/native_protocol_v4.spec#L1053-L1055 ErrCodeProtocol frame.ErrorCode = 0x000A // ErrCodeCredentials indicates missing required authentication. // See https://github.com/apache/cassandra/blob/adcff3f630c0d07d1ba33bf23fcb11a6db1b9af1/doc/native_protocol_v4.spec#L1056-L1059 ErrCodeCredentials frame.ErrorCode = 0x0100 // See https://github.com/apache/cassandra/blob/adcff3f630c0d07d1ba33bf23fcb11a6db1b9af1/doc/native_protocol_v4.spec#L1060-L1070 ErrCodeUnavailable frame.ErrorCode = 0x1000 // ErrCodeOverloaded returned in case of request on overloaded node coordinator. // See https://github.com/apache/cassandra/blob/adcff3f630c0d07d1ba33bf23fcb11a6db1b9af1/doc/native_protocol_v4.spec#L1071-L1072 ErrCodeOverloaded frame.ErrorCode = 0x1001 // ErrCodeBootstrapping returned from the coordinator node in bootstrapping phase. // See https://github.com/apache/cassandra/blob/adcff3f630c0d07d1ba33bf23fcb11a6db1b9af1/doc/native_protocol_v4.spec#L1073-L1074 ErrCodeBootstrapping frame.ErrorCode = 0x1002 // ErrCodeTruncate indicates truncation exception. // See https://github.com/apache/cassandra/blob/adcff3f630c0d07d1ba33bf23fcb11a6db1b9af1/doc/native_protocol_v4.spec#L1075 ErrCodeTruncate frame.ErrorCode = 0x1003 // ErrCodeWriteTimeout returned in case of timeout during the request write. // See https://github.com/apache/cassandra/blob/adcff3f630c0d07d1ba33bf23fcb11a6db1b9af1/doc/native_protocol_v4.spec#L1076-L1107 ErrCodeWriteTimeout frame.ErrorCode = 0x1100 // ErrCodeReadTimeout returned in case of timeout during the request read. // See https://github.com/apache/cassandra/blob/adcff3f630c0d07d1ba33bf23fcb11a6db1b9af1/doc/native_protocol_v4.spec#L1108-L1124 ErrCodeReadTimeout frame.ErrorCode = 0x1200 // ErrCodeReadFailure indicates request read error which is not covered by ErrCodeReadTimeout. // See https://github.com/apache/cassandra/blob/adcff3f630c0d07d1ba33bf23fcb11a6db1b9af1/doc/native_protocol_v4.spec#L1125-L1139 ErrCodeReadFailure frame.ErrorCode = 0x1300 // ErrCodeFunctionFailure indicates an error in user-defined function. // See https://github.com/apache/cassandra/blob/adcff3f630c0d07d1ba33bf23fcb11a6db1b9af1/doc/native_protocol_v4.spec#L1140-L1146 ErrCodeFunctionFailure frame.ErrorCode = 0x1400 // ErrCodeWriteFailure indicates request write error which is not covered by ErrCodeWriteTimeout. // See https://github.com/apache/cassandra/blob/adcff3f630c0d07d1ba33bf23fcb11a6db1b9af1/doc/native_protocol_v4.spec#L1147-L1180 ErrCodeWriteFailure frame.ErrorCode = 0x1500 // ErrCodeSyntax indicates the syntax error in the query. // See https://github.com/apache/cassandra/blob/adcff3f630c0d07d1ba33bf23fcb11a6db1b9af1/doc/native_protocol_v4.spec#L1182 ErrCodeSyntax frame.ErrorCode = 0x2000 // See https://github.com/apache/cassandra/blob/adcff3f630c0d07d1ba33bf23fcb11a6db1b9af1/doc/native_protocol_v4.spec#L1183-L1184 ErrCodeUnauthorized frame.ErrorCode = 0x2100 // ErrCodeInvalid indicates invalid query error which is not covered by ErrCodeSyntax. // See https://github.com/apache/cassandra/blob/adcff3f630c0d07d1ba33bf23fcb11a6db1b9af1/doc/native_protocol_v4.spec#L1185 ErrCodeInvalid frame.ErrorCode = 0x2200 // ErrCodeConfig indicates the configuration error. // See https://github.com/apache/cassandra/blob/adcff3f630c0d07d1ba33bf23fcb11a6db1b9af1/doc/native_protocol_v4.spec#L1186 ErrCodeConfig frame.ErrorCode = 0x2300 // ErrCodeAlreadyExists is returned for the requests creating the existing keyspace/table. // See https://github.com/apache/cassandra/blob/adcff3f630c0d07d1ba33bf23fcb11a6db1b9af1/doc/native_protocol_v4.spec#L1187-L1196 ErrCodeAlreadyExists frame.ErrorCode = 0x2400 // ErrCodeUnprepared returned from the host for prepared statement which is unknown. // See https://github.com/apache/cassandra/blob/adcff3f630c0d07d1ba33bf23fcb11a6db1b9af1/doc/native_protocol_v4.spec#L1197-L1200 ErrCodeUnprepared frame.ErrorCode = 0x2500 )
See CQL Binary Protocol v4, section 9 for more details. https://github.com/apache/cassandra/blob/adcff3f630c0d07d1ba33bf23fcb11a6db1b9af1/doc/native_protocol_v4.spec#L1046-L1200
Variables ¶
View Source
var ( ErrClosedIter = fmt.Errorf("iter is closed") ErrNoMoreRows = fmt.Errorf("no more rows left") )
View Source
var ( ErrNoHosts = fmt.Errorf("error in session config: no hosts given") ErrEventType = fmt.Errorf("error in session config: invalid event\npossible events:\n" + "TopologyChange EventType = \"TOPOLOGY_CHANGE\"\n" + "StatusChange EventType = \"STATUS_CHANGE\"\n" + "SchemaChange EventType = \"SCHEMA_CHANGE\"") ErrConsistency = fmt.Errorf("error in session config: invalid consistency\npossible consistencies are:\n" + "ANY Consistency = 0x0000\n" + "ONE Consistency = 0x0001\n" + "TWO Consistency = 0x0002\n" + "THREE Consistency = 0x0003\n" + "QUORUM Consistency = 0x0004\n" + "ALL Consistency = 0x0005\n" + "LOCALQUORUM Consistency = 0x0006\n" + "EACHQUORUM Consistency = 0x0007\n" + "SERIAL Consistency = 0x0008\n" + "LOCALSERIAL Consistency = 0x0009\n" + "LOCALONE Consistency = 0x000A") )
View Source
var ErrNoQueryResults = fmt.Errorf("no query results to be fetched")
Functions ¶
This section is empty.
Types ¶
type Compression ¶
type Compression = frame.Compression
var ( Snappy Compression = frame.Snappy Lz4 Compression = frame.Lz4 )
type Consistency ¶
type Consistency = uint16
const ( ANY Consistency = 0x0000 ONE Consistency = 0x0001 TWO Consistency = 0x0002 THREE Consistency = 0x0003 QUORUM Consistency = 0x0004 ALL Consistency = 0x0005 LOCALQUORUM Consistency = 0x0006 EACHQUORUM Consistency = 0x0007 SERIAL Consistency = 0x0008 LOCALSERIAL Consistency = 0x0009 LOCALONE Consistency = 0x000A )
type DebugLogger ¶
type DebugLogger = transport.DebugLogger
type DefaultLogger ¶
type DefaultLogger = transport.DefaultLogger
type Iter ¶
type Iter struct {
// contains filtered or unexported fields
}
func (*Iter) Columns ¶
func (it *Iter) Columns() []frame.ColumnSpec
type Query ¶
type Query struct {
// contains filtered or unexported fields
}
func (*Query) Bind ¶
func (q *Query) Bind(pos int, v Serializable) *Query
BindAny allows binding any value to the bind marker at given pos in query, it shouldn't be used on non-prepared queries, as it will always result in query execution error later.
func (*Query) Compression ¶
func (*Query) Idempotent ¶ added in v0.1.5
func (*Query) NoSkipMetadata ¶
func (*Query) RetryPolicy ¶ added in v0.1.9
func (q *Query) RetryPolicy() transport.RetryPolicy
func (*Query) SerialConsistency ¶
func (q *Query) SerialConsistency(v frame.Consistency) frame.Consistency
func (*Query) SetCompression ¶
func (*Query) SetIdempotent ¶ added in v0.1.5
func (*Query) SetPageSize ¶
func (*Query) SetPageState ¶
func (*Query) SetRetryPolicy ¶ added in v0.1.9
func (q *Query) SetRetryPolicy(v transport.RetryPolicy) *Query
func (*Query) SetSerialConsistency ¶
func (q *Query) SetSerialConsistency(v frame.Consistency)
type Result ¶
type Result transport.QueryResult
type Serializable ¶
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
func NewSession ¶
func NewSession(ctx context.Context, cfg SessionConfig) (*Session, error)
func (*Session) AwaitSchemaAgreement ¶ added in v0.1.5
func (*Session) CheckSchemaAgreement ¶ added in v0.1.5
func (*Session) NewTokenAwareDCAwarePolicy ¶
func (s *Session) NewTokenAwareDCAwarePolicy(localDC string) transport.HostSelectionPolicy
func (*Session) NewTokenAwarePolicy ¶
func (s *Session) NewTokenAwarePolicy() transport.HostSelectionPolicy
type SessionConfig ¶
type SessionConfig struct { Hosts []string Events []EventType HostSelectionPolicy transport.HostSelectionPolicy RetryPolicy transport.RetryPolicy SchemaAgreementInterval time.Duration // Controls the timeout for the automatic wait for schema agreement after sending a schema-altering statement. // If less or equal to 0, the automatic schema agreement is disabled. AutoAwaitSchemaAgreementTimeout time.Duration transport.ConnConfig }
func DefaultSessionConfig ¶
func DefaultSessionConfig(keyspace string, hosts ...string) SessionConfig
func (SessionConfig) Clone ¶
func (cfg SessionConfig) Clone() SessionConfig
func (*SessionConfig) Validate ¶
func (cfg *SessionConfig) Validate() error
Click to show internal directories.
Click to hide internal directories.