Documentation
¶
Index ¶
- Constants
- Variables
- type Backend
- type Collection
- type DB
- type DeleteFlags
- type Header
- type InsertFlags
- type MemoryBackend
- func (b *MemoryBackend) DB(name string) DB
- func (b *MemoryBackend) DBNames() (result []string)
- func (b *MemoryBackend) HandleDelete(c net.Conn, deleteMsg *OpDeleteMsg)
- func (b *MemoryBackend) HandleInsert(c net.Conn, insert *OpInsertMsg)
- func (b *MemoryBackend) HandleQuery(c net.Conn, query *OpQueryMsg)
- func (b *MemoryBackend) HandleUpdate(c net.Conn, update *OpUpdateMsg)
- type MemoryCollection
- func (c *MemoryCollection) All() (result []interface{})
- func (c *MemoryCollection) Delete(pattern bson.M, limit int) int
- func (c *MemoryCollection) Id(id string) interface{}
- func (c *MemoryCollection) Insert(doc interface{}) error
- func (c *MemoryCollection) Match(pattern bson.M) (result []interface{})
- type MemoryDB
- type OpCode
- type OpDeleteMsg
- type OpInsertMsg
- type OpQueryMsg
- type OpReplyMsg
- type OpUpdateMsg
- type QueryFlags
- type Server
- type UpdateFlags
- type WriteResult
Constants ¶
View Source
const ( QueryFlagTailableCursor = 1 << 1 QueryFlagSlaveOk = 1 << 2 QueryFlagOplogReplay = 1 << 3 QueryFlagNoCursorTimeout = 1 << 4 QueryFlagAwaitData = 1 << 5 QueryFlagExhaust = 1 << 6 QueryFlagPartial = 1 << 7 )
View Source
const ( UpdateFlagUpsert = 1 << 0 UpdateFlagMultiUpdate = 1 << 1 )
View Source
const (
DeleteFlagSingleRemove = 1 << 0
)
View Source
const (
InsertFlagContinueOnError = 1 << 0
)
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend interface {
HandleQuery(c net.Conn, query *OpQueryMsg)
HandleInsert(c net.Conn, insert *OpInsertMsg)
HandleUpdate(c net.Conn, update *OpUpdateMsg)
HandleDelete(c net.Conn, deleteMsg *OpDeleteMsg)
DBNames() []string
DB(name string) DB
}
type Collection ¶
type DB ¶
type DB interface {
Empty() bool
CNames() []string
C(name string) Collection
LastError() interface{}
SetLastError(doc interface{})
}
type DeleteFlags ¶
type DeleteFlags int32
type InsertFlags ¶
type InsertFlags int32
type MemoryBackend ¶
type MemoryBackend struct {
// contains filtered or unexported fields
}
func NewMemoryBackend ¶
func NewMemoryBackend(t *tomb.Tomb) *MemoryBackend
func (*MemoryBackend) DB ¶
func (b *MemoryBackend) DB(name string) DB
func (*MemoryBackend) DBNames ¶
func (b *MemoryBackend) DBNames() (result []string)
func (*MemoryBackend) HandleDelete ¶
func (b *MemoryBackend) HandleDelete(c net.Conn, deleteMsg *OpDeleteMsg)
func (*MemoryBackend) HandleInsert ¶
func (b *MemoryBackend) HandleInsert(c net.Conn, insert *OpInsertMsg)
func (*MemoryBackend) HandleQuery ¶
func (b *MemoryBackend) HandleQuery(c net.Conn, query *OpQueryMsg)
func (*MemoryBackend) HandleUpdate ¶
func (b *MemoryBackend) HandleUpdate(c net.Conn, update *OpUpdateMsg)
type MemoryCollection ¶
type MemoryCollection struct {
// contains filtered or unexported fields
}
func (*MemoryCollection) All ¶
func (c *MemoryCollection) All() (result []interface{})
func (*MemoryCollection) Id ¶
func (c *MemoryCollection) Id(id string) interface{}
func (*MemoryCollection) Insert ¶
func (c *MemoryCollection) Insert(doc interface{}) error
func (*MemoryCollection) Match ¶
func (c *MemoryCollection) Match(pattern bson.M) (result []interface{})
type MemoryDB ¶
type MemoryDB struct {
// contains filtered or unexported fields
}
func NewMemoryDB ¶
func NewMemoryDB() *MemoryDB
func (*MemoryDB) C ¶
func (db *MemoryDB) C(name string) Collection
func (*MemoryDB) SetLastError ¶
func (db *MemoryDB) SetLastError(doc interface{})
type OpDeleteMsg ¶
type OpDeleteMsg struct {
*Header
// "dbname.collectionname"
FullCollectionName string
// Bit vector of update options.
Flags DeleteFlags
// Selector matches the documents to delete.
Selector bson.M
// contains filtered or unexported fields
}
func NewOpDeleteMsg ¶
func NewOpDeleteMsg(h *Header) (*OpDeleteMsg, error)
type OpInsertMsg ¶
type OpInsertMsg struct {
*Header
// Bit vector of query options.
Flags InsertFlags
// "dbname.collectionname"
FullCollectionName string
// one or more documents to insert into the collection
Docs []bson.M
}
func NewOpInsertMsg ¶
func NewOpInsertMsg(h *Header) (*OpInsertMsg, error)
type OpQueryMsg ¶
type OpQueryMsg struct {
*Header
// Bit vector of query options.
Flags QueryFlags
// "dbname.collectionname"
FullCollectionName string
// number of documents to skip
NumberToSkip int32
// number of documents to return in the first OP_REPLY batch
NumberToReturn int32
// query object. See below for details.
Doc bson.D
// Optional. Selector indicating the fields to return.
ReturnFieldsSelector bson.D
}
func NewOpQueryMsg ¶
func NewOpQueryMsg(h *Header) (*OpQueryMsg, error)
func (*OpQueryMsg) Command ¶
func (m *OpQueryMsg) Command() (cmd string, arg interface{})
func (*OpQueryMsg) Get ¶
func (m *OpQueryMsg) Get(key string) (interface{}, bool)
type OpReplyMsg ¶
type OpReplyMsg struct {
*Header
// bit vector - see details below
ResponseFlags int32
// cursor id if client needs to do get more's
CursorID int64
// where in the cursor this reply is starting
StartingFrom int32
// number of documents in the reply
NumberReturned int32
// documents
Docs []interface{}
// contains filtered or unexported fields
}
func NewOpReplyMsg ¶
func NewOpReplyMsg(responseTo int32, docs ...interface{}) *OpReplyMsg
type OpUpdateMsg ¶
type OpUpdateMsg struct {
*Header
// "dbname.collectionname"
FullCollectionName string
// Bit vector of update options.
Flags UpdateFlags
// Selector is the query to select the document.
Selector bson.M
// Update is the document update specification.
Update bson.M
// contains filtered or unexported fields
}
func NewOpUpdateMsg ¶
func NewOpUpdateMsg(h *Header) (*OpUpdateMsg, error)
type QueryFlags ¶
type QueryFlags int32
type Server ¶
type Server struct {
Backend Backend
// contains filtered or unexported fields
}
func NewServerAddr ¶
type UpdateFlags ¶
type UpdateFlags int32
type WriteResult ¶
Click to show internal directories.
Click to hide internal directories.