Documentation ¶
Index ¶
- Constants
- Variables
- func Call(fn func(pool.Src) error) error
- func Close()
- func CollectionNames(dbname string) (names []string, err error)
- func DatabaseNames() (names []string, err error)
- func Error() error
- func Len() int
- func Mgo(resultPtr interface{}, operate string, option map[string]interface{}) error
- func Refresh()
- type Count
- type Find
- type Insert
- type List
- type MgoSrc
- type Operator
- type Remove
- type Update
- type UpdateAll
- type Upsert
Constants ¶
const (
MaxLen int = 5000 // allocate the insert
)
Variables ¶
var ( MgoPool = pool.ClassicPool( config.MGO_CONN_CAP, config.MGO_CONN_CAP/5, func() (pool.Src, error) { return &MgoSrc{session.Clone()}, err }, connGcSecond) )
Functions ¶
func CollectionNames ¶
Get the list of database collections
func Mgo ¶
Create a unified method of checking and removing operations count operation resultPtr type is * int list operation The resultPtr type is * map [string] [] string find operation resultPtr type * map [string] interface {} insert operation resultPtr type is * [] string, allowed to nil (do not receive id list) The update operation resultPtr is nil remove operation resultPtr is nil
Types ¶
type Count ¶
type Count struct { Database string // database Collection string // collection Query map[string]interface{} // Check for phrases }
incoming database and collection name | return the total number of documents
type Find ¶
type Find struct { Database string // database Collection string // collection Query map[string]interface{} // Check for phrases Sort []string // sort, usage such as Sort ("firstname", "-lastname"), preceded by firstname, followed by lastname Skip int // skip the previous n documents Limit int // return up to n documents Select interface{} // query only, return to the specified field, such as {"name": 1} }
in the specified set of conditions for inquiries
type Insert ¶
type Insert struct { Database string // database Collection string // collection Docs []map[string]interface{} // documentation }
insert new data
type List ¶
type List struct {
Dbs []string // list of database names
}
incoming database list | return database and its collection tree
type MgoSrc ¶
type Operator ¶
type Operator interface {
Exec(resultPtr interface{}) (err error)
}
add or delete operations
type Remove ¶
type Remove struct { Database string // database Collection string // collection Selector map[string]interface{} // document selector }
delete data
type Update ¶
type Update struct { Database string // database Collection string // collection Selector map[string]interface{} // document selector Change map[string]interface{} // document update content }
update the first matching data
type UpdateAll ¶
type UpdateAll struct { Database string // database Collection string // collection Selector map[string]interface{} // document selector Change map[string]interface{} // document update content }
Update all matching data