Documentation ¶
Index ¶
- Variables
- func Hex(oid ObjectID) string
- func IsObjectIdHex(s string) bool
- type Client
- func (c *Client) FindAndModify(database, collection string, selector, update M, upsert bool, ...) (int, error)
- func (c *Client) FindAndRemove(database, collection string, selector M, result interface{}) (int, error)
- func (c *Client) GetCount(database, collection string, query M) (int, error)
- func (c *Client) GetPipeResult(database, collection string, pipeline []M, result *[]M) error
- func (c *Client) GetPipeRow(database, collection string, pipeline []M, result *M) error
- func (c *Client) GetResult(database, collection string, query, fields, options M, result interface{}) error
- func (c *Client) GetRow(database, collection string, query, options M, result interface{}) error
- func (c *Client) Insert(database, collection string, docs ...interface{}) error
- func (c *Client) Ping() error
- func (c *Client) Remove(database, collection string, selector M) error
- func (c *Client) RemoveAll(database, collection string, selector M) (int, error)
- func (c *Client) Update(database, collection string, selector, update M) error
- func (c *Client) UpdateAll(database, collection string, selector, update M) (map[string]interface{}, error)
- func (c *Client) Upsert(database, collection string, selector, update M) (map[string]interface{}, error)
- type D
- type M
- type ObjectID
- type Sort
Constants ¶
This section is empty.
Variables ¶
View Source
var ( //ErrNotFound 数据没有找到 ErrNotFound = mgo.ErrNotFound )
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client mongodb连接结构体
func (*Client) FindAndModify ¶
func (c *Client) FindAndModify(database, collection string, selector, update M, upsert bool, result interface{}) (int, error)
FindAndModify 查找并修改数据
func (*Client) FindAndRemove ¶
func (c *Client) FindAndRemove(database, collection string, selector M, result interface{}) (int, error)
FindAndRemove 查找并删除数据
func (*Client) GetPipeResult ¶
GetPipeResult 使用管道进行聚合计算并返回多行结果集
func (*Client) GetPipeRow ¶
GetPipeRow 使用管道进行聚合计算并返回一行数据
func (*Client) GetResult ¶
func (c *Client) GetResult(database, collection string, query, fields, options M, result interface{}) error
GetResult 返回多行结果集
Click to show internal directories.
Click to hide internal directories.