rql

package
v0.0.0-...-a1b7954 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2014 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MsgpackHandle = &codec.MsgpackHandle{}
)

Functions

This section is empty.

Types

type Conn

type Conn interface {
	CreateDB(name, driver string, config kissdif.Dictionary) (Database, error)
	DropDB(name string) error
	Get(impl QueryImpl) (ResultSet, error)
	Put(impl QueryImpl) (string, error)
	Delete(impl QueryImpl) error
}

func Connect

func Connect(url string) (Conn, error)

type Database

type Database interface {
	DropTable(name string) ExecStmt
	Table(name string) Table
}

func DB

func DB(name string) Database

type Decoder

type Decoder interface {
	Decode(v interface{}) error
}

type Encoder

type Encoder interface {
	Encode(v interface{}) error
}

type ExecStmt

type ExecStmt interface {
	Exec(conn Conn) error
}

type Indexable

type Indexable interface {
	Query
	By(index string) Query
}

type Limitable

type Limitable interface {
	MultiStmt
	Limit(count uint) Query
}

type MakeDecoder

type MakeDecoder func(io.Reader) Decoder

type MakeEncoder

type MakeEncoder func(io.Writer) Encoder

type MultiStmt

type MultiStmt interface {
	Exec(conn Conn) (ResultSet, error)
}

type PutStmt

type PutStmt interface {
	Exec(conn Conn) (string, error)
	By(key, value string) PutStmt
	Keys(keys kissdif.IndexMap) PutStmt
}

type Query

type Query interface {
	Limitable
	Get(key string) SingleStmt
	GetAll(key string) Limitable
	Between(lower, upper string) Limitable
}

type QueryImpl

type QueryImpl struct {
	Db_     string
	Table_  string
	Record_ kissdif.Record
	Query_  kissdif.Query
}

func (QueryImpl) Between

func (this QueryImpl) Between(lower, upper string) Limitable

func (QueryImpl) By

func (this QueryImpl) By(index string) Query

func (QueryImpl) Delete

func (this QueryImpl) Delete(id, rev string) ExecStmt

func (QueryImpl) DeleteRecord

func (this QueryImpl) DeleteRecord(record Record) ExecStmt

func (QueryImpl) DropTable

func (this QueryImpl) DropTable(name string) ExecStmt

func (QueryImpl) Exec

func (this QueryImpl) Exec(conn Conn) (ResultSet, error)

func (QueryImpl) Get

func (this QueryImpl) Get(key string) SingleStmt

func (QueryImpl) GetAll

func (this QueryImpl) GetAll(key string) Limitable

func (QueryImpl) Insert

func (this QueryImpl) Insert(id string, doc interface{}) PutStmt

func (QueryImpl) Limit

func (this QueryImpl) Limit(count uint) Query

func (QueryImpl) Table

func (this QueryImpl) Table(name string) Table

func (QueryImpl) Update

func (this QueryImpl) Update(id, rev string, doc interface{}) PutStmt

func (QueryImpl) UpdateRecord

func (this QueryImpl) UpdateRecord(record Record) PutStmt

type Record

type Record interface {
	Id() string
	Rev() string
	Keys() kissdif.IndexMap

	Scan(into interface{}) (interface{}, error)
	MustScan(into interface{}) interface{}

	Set(doc interface{}) error
	MustSet(doc interface{})
}

type RecordImpl

type RecordImpl struct {
	Id_   string           `json:"id,omitempty" codec:"id,omitempty"`
	Rev_  string           `json:"rev,omitempty" codec:"rev,omitempty"`
	Doc_  json.RawMessage  `json:"doc,omitempty" codec:"doc,omitempty"`
	Keys_ kissdif.IndexMap `json:"keys,omitempty" codec:"keys,omitempty"`
}

func (*RecordImpl) Id

func (this *RecordImpl) Id() string

func (*RecordImpl) Keys

func (this *RecordImpl) Keys() kissdif.IndexMap

func (*RecordImpl) MustScan

func (this *RecordImpl) MustScan(into interface{}) interface{}

func (*RecordImpl) MustSet

func (this *RecordImpl) MustSet(doc interface{})

func (*RecordImpl) Rev

func (this *RecordImpl) Rev() string

func (*RecordImpl) Scan

func (this *RecordImpl) Scan(into interface{}) (interface{}, error)

func (*RecordImpl) Set

func (this *RecordImpl) Set(doc interface{}) (err error)

type RecordReader

type RecordReader interface {
	Next() bool
	Record() Record
	Scan(into interface{}) (interface{}, error)
	MustScan(into interface{}) interface{}
}

type RecordReaderImpl

type RecordReaderImpl struct {
	// contains filtered or unexported fields
}

func (*RecordReaderImpl) MustScan

func (this *RecordReaderImpl) MustScan(into interface{}) interface{}

func (*RecordReaderImpl) Next

func (this *RecordReaderImpl) Next() bool

func (*RecordReaderImpl) Record

func (this *RecordReaderImpl) Record() Record

func (*RecordReaderImpl) Scan

func (this *RecordReaderImpl) Scan(into interface{}) (interface{}, error)

type ResultSet

type ResultSet interface {
	More() bool
	Count() int
	Reader() RecordReader
}

type ResultSetImpl

type ResultSetImpl struct {
	More_    bool          `json:"more,omitempty" codec:"more,omitempty"`
	Records_ []*RecordImpl `json:"records,omitempty" codec:"records,omitempty"`
}

func (*ResultSetImpl) Count

func (this *ResultSetImpl) Count() int

func (*ResultSetImpl) More

func (this *ResultSetImpl) More() bool

func (*ResultSetImpl) Reader

func (this *ResultSetImpl) Reader() RecordReader

type SingleStmt

type SingleStmt interface {
	Exec(conn Conn) (Record, error)
}

type Table

type Table interface {
	Indexable
	Insert(id string, doc interface{}) PutStmt
	Update(id, rev string, doc interface{}) PutStmt
	Delete(id, rev string) ExecStmt
	UpdateRecord(record Record) PutStmt
	DeleteRecord(record Record) ExecStmt
}

Jump to

Keyboard shortcuts

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