gocql.go 924 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // Copyright (c) 2012 The gocql Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. package gocql
  5. import (
  6. "errors"
  7. )
  8. type queryContext interface {
  9. executeQuery(query *Query) (frame, error)
  10. }
  11. type ColumnInfo struct {
  12. Keyspace string
  13. Table string
  14. Name string
  15. TypeInfo *TypeInfo
  16. }
  17. /*
  18. type Batch struct {
  19. queries []*Query
  20. ctx queryContext
  21. cons Consistency
  22. }
  23. func (b *Batch) Query(stmt string, args ...interface{}) *Query {
  24. return &Query{
  25. stmt: stmt,
  26. args: args,
  27. cons: b.cons,
  28. //ctx: b,
  29. }
  30. }
  31. func (b *Batch) Apply() error {
  32. return nil
  33. } */
  34. type Error struct {
  35. Code int
  36. Message string
  37. }
  38. func (e Error) Error() string {
  39. return e.Message
  40. }
  41. var (
  42. ErrNotFound = errors.New("not found")
  43. ErrNoHostAvailable = errors.New("no host available")
  44. ErrProtocol = errors.New("protocol error")
  45. )