Documentation ¶
Index ¶
- func Id2String(id interface{}) string
- type Cmp
- type Coll
- func (c *Coll) CloneTo(to *Coll) (cloneCount int, err error)
- func (c *Coll) Count(filter interface{}) (int64, error)
- func (c *Coll) Exist() (bool, error)
- func (c *Coll) Find(query interface{}) (*Cursor, error)
- func (c *Coll) FindCmp(path string, cmpopt Cmp, value bsonx.Val) (*Cursor, error)
- func (c *Coll) FindEdge(limit int64, asc bool) (*Cursor, error)
- func (c *Coll) FindId(id interface{}, decodeResult interface{}) (found bool, err error)
- func (c *Coll) IdExists(id interface{}) (bool, error)
- func (c *Coll) Insert(doc interface{}) error
- func (c *Coll) InsertIfNotExists(selector interface{}, update interface{}) error
- func (c *Coll) InsertMany(docs ...interface{}) error
- func (c *Coll) Max(itemPath string, typeSample interface{}) (interface{}, error)
- func (c *Coll) MaxFloat(floatPath string) (float64, error)
- func (c *Coll) MaxInt64(intPath string) (int64, error)
- func (c *Coll) MaxTime(intPath string) (time.Time, error)
- func (c *Coll) Min(itemPath string, typeSample interface{}) (interface{}, error)
- func (c *Coll) MinFloat(floatPath string) (float64, error)
- func (c *Coll) MinInt64(intPath string) (int64, error)
- func (c *Coll) MinTime(intPath string) (time.Time, error)
- func (c *Coll) Remove(selector interface{}) error
- func (c *Coll) RemoveAll(selector interface{}) error
- func (c *Coll) RemoveCmp(path string, cmpopt Cmp, value bsonx.Val) (int64, error)
- func (c *Coll) RemoveCmpIntId(id int64, cmpopt Cmp) error
- func (c *Coll) RemoveId(id interface{}) error
- func (c *Coll) RemoveObjectId(id primitive.ObjectID) error
- func (c *Coll) RemovePartDocs(selector interface{}, toRemove interface{}) error
- func (c *Coll) RemoveStringId(stringId string) error
- func (c *Coll) Upsert(selector interface{}, update interface{}) error
- func (c *Coll) UpsertEntireDoc(id interface{}, doc interface{}) error
- func (c *Coll) UpsertFields(id interface{}, doc interface{}) error
- func (c *Coll) VerifyContinuousInt64Id() (*grange.RangeFilter, error)
- type Conn
- type ConnFromPool
- type Cursor
- type Database
- func (d *Database) C(collName string) *Coll
- func (d *Database) CExists(collName string) (bool, error)
- func (d *Database) CNames() ([]string, error)
- func (d *Database) DeleteC(collName string) error
- func (d *Database) Exist() (bool, error)
- func (d *Database) RenameC(from, to string) error
- func (d *Database) Watch() error
- type Pool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Coll ¶
type Coll struct {
// contains filtered or unexported fields
}
func (*Coll) Count ¶
count by documents WARNING: this API is slow but correct if metadata is incorrect
func (*Coll) Find ¶
if DB / Coll doesn't exist, returns valid *Cursor and nil error, but cur.Next() == false
func (*Coll) InsertIfNotExists ¶
未测试! if not exists: insert
func (*Coll) InsertMany ¶
func (*Coll) RemovePartDocs ¶
未测试!
func (*Coll) RemoveStringId ¶
func (*Coll) UpsertEntireDoc ¶
note: time.Time precision in MongoDB is Milliseconds, but in Go it is Nanoseconds, if time.Time used to be _id of document, please note the precision!
func (*Coll) UpsertFields ¶
if not exists: insert, if exists: update
func (*Coll) VerifyContinuousInt64Id ¶
func (c *Coll) VerifyContinuousInt64Id() (*grange.RangeFilter, error)
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
type ConnFromPool ¶
type ConnFromPool struct {
// contains filtered or unexported fields
}
func (*ConnFromPool) RawConn ¶
func (ce *ConnFromPool) RawConn() *Conn
type Cursor ¶
type Cursor struct {
// contains filtered or unexported fields
}
func (*Cursor) DecodeBson ¶
TODO: test required, test at CloneTo()
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
func (*Pool) GetAvailable ¶
func (p *Pool) GetAvailable() (*ConnFromPool, bool)
func (*Pool) PutBack ¶
func (p *Pool) PutBack(cex **ConnFromPool)
func (*Pool) WaitAvailable ¶
func (p *Pool) WaitAvailable() *ConnFromPool
Click to show internal directories.
Click to hide internal directories.