Documentation
¶
Index ¶
- type Collection
- type Config
- type Database
- type IService
- type Page
- type Service
- func (this_ *Service) BatchInsert(database string, collection string, documents []interface{}, ...) (insertedIds []interface{}, err error)
- func (this_ *Service) BatchUpdate(database string, collection string, filter interface{}, update interface{}, ...) (updateResult *UpdateResult, err error)
- func (this_ *Service) Close()
- func (this_ *Service) CollectionCreate(database string, collection string, opts ...*options.CreateCollectionOptions) (err error)
- func (this_ *Service) CollectionDelete(database string, collection string) (err error)
- func (this_ *Service) Collections(database string) (collections []*Collection, err error)
- func (this_ *Service) Count(database string, collection string, filter interface{}) (totalCount int64, err error)
- func (this_ *Service) DatabaseDelete(database string) (err error)
- func (this_ *Service) Databases() (databases []*Database, totalSize int64, err error)
- func (this_ *Service) DeleteMany(database string, collection string, filter interface{}) (deletedCount int64, err error)
- func (this_ *Service) DeleteOne(database string, collection string, filter interface{}) (deletedCount int64, err error)
- func (this_ *Service) GetServers() []string
- func (this_ *Service) IndexCreate(database string, collection string, index mongo.IndexModel) (name string, err error)
- func (this_ *Service) IndexDelete(database string, collection string, name string) (err error)
- func (this_ *Service) IndexDeleteAll(database string, collection string) (err error)
- func (this_ *Service) Indexes(database string, collection string) (indexes []map[string]interface{}, err error)
- func (this_ *Service) IndexesCreate(database string, collection string, indexes []mongo.IndexModel) (names []string, err error)
- func (this_ *Service) Insert(database string, collection string, document interface{}, ...) (insertedId interface{}, err error)
- func (this_ *Service) QueryMap(database string, collection string, filter interface{}, ...) (list []map[string]interface{}, err error)
- func (this_ *Service) QueryMapPage(database string, collection string, filter interface{}, page *Page, ...) (list []map[string]interface{}, err error)
- func (this_ *Service) QueryMapPageResult(database string, collection string, filter interface{}, page *Page, ...) (pageResult *Page, err error)
- func (this_ *Service) Update(database string, collection string, id interface{}, update interface{}, ...) (updateResult *UpdateResult, err error)
- func (this_ *Service) UpdateOne(database string, collection string, filter interface{}, update interface{}, ...) (updateResult *UpdateResult, err error)
- type UpdateResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Collection ¶
type Config ¶
type Config struct {
// Disabled 禁用 上层 初始化服务时候 可以判断该属性 如果为 配置 true 则不去初始化服务
Disabled bool `json:"disabled,omitempty" yaml:"disabled,omitempty"`
Address string `json:"address" yaml:"address"`
Username string `json:"username,omitempty" yaml:"username,omitempty"`
Password string `json:"password,omitempty" yaml:"password,omitempty"`
MinPoolSize int `json:"minPoolSize,omitempty" yaml:"minPoolSize,omitempty"`
MaxPoolSize int `json:"maxPoolSize,omitempty" yaml:"maxPoolSize,omitempty"`
ConnectTimeout int `json:"connectTimeout,omitempty" yaml:"connectTimeout,omitempty"` // 客户端连接超时 单位 毫秒
CertPath string `json:"certPath,omitempty" yaml:"certPath,omitempty"`
}
type IService ¶
type IService interface {
Close()
Databases() (databases []*Database, totalSize int64, err error)
DatabaseDelete(database string) (err error)
Collections(database string) (collections []*Collection, err error)
CollectionCreate(database string, collection string, opts ...*options.CreateCollectionOptions) (err error)
CollectionDelete(database string, collection string) (err error)
Indexes(database string, collection string) (indexes []map[string]interface{}, err error)
IndexCreate(database string, collection string, index mongo.IndexModel) (name string, err error)
IndexesCreate(database string, collection string, indexes []mongo.IndexModel) (names []string, err error)
IndexDelete(database string, collection string, name string) (err error)
IndexDeleteAll(database string, collection string) (err error)
Insert(database string, collection string, document interface{}, opts ...*options.InsertOneOptions) (insertedId interface{}, err error)
BatchInsert(database string, collection string, documents []interface{}, opts ...*options.InsertManyOptions) (insertedIds []interface{}, err error)
Update(database string, collection string, id interface{}, update interface{}, opts ...*options.UpdateOptions) (updateResult *UpdateResult, err error)
UpdateOne(database string, collection string, filter interface{}, update interface{}, opts ...*options.UpdateOptions) (updateResult *UpdateResult, err error)
BatchUpdate(database string, collection string, filter interface{}, update interface{}, opts ...*options.UpdateOptions) (updateResult *UpdateResult, err error)
Count(database string, collection string, filter interface{}) (totalCount int64, err error)
QueryMap(database string, collection string, filter interface{}, opts *options.FindOptions) (list []map[string]interface{}, err error)
QueryMapPage(database string, collection string, filter interface{}, page *Page, opts *options.FindOptions) (list []map[string]interface{}, err error)
QueryMapPageResult(database string, collection string, filter interface{}, page *Page, opts *options.FindOptions) (pageResult *Page, err error)
DeleteOne(database string, collection string, filter interface{}) (deletedCount int64, err error)
DeleteMany(database string, collection string, filter interface{}) (deletedCount int64, err error)
}
type Service ¶
type Service struct {
*Config
// contains filtered or unexported fields
}
func (*Service) BatchInsert ¶
func (*Service) BatchUpdate ¶
func (this_ *Service) BatchUpdate(database string, collection string, filter interface{}, update interface{}, opts ...*options.UpdateOptions) (updateResult *UpdateResult, err error)
func (*Service) CollectionCreate ¶
func (*Service) CollectionDelete ¶
func (*Service) Collections ¶
func (this_ *Service) Collections(database string) (collections []*Collection, err error)
func (*Service) DatabaseDelete ¶
func (*Service) DeleteMany ¶
func (*Service) GetServers ¶
func (*Service) IndexCreate ¶
func (*Service) IndexDelete ¶
func (*Service) IndexDeleteAll ¶
func (*Service) IndexesCreate ¶
func (*Service) QueryMapPage ¶
func (*Service) QueryMapPageResult ¶
func (*Service) Update ¶
func (this_ *Service) Update(database string, collection string, id interface{}, update interface{}, opts ...*options.UpdateOptions) (updateResult *UpdateResult, err error)
func (*Service) UpdateOne ¶
func (this_ *Service) UpdateOne(database string, collection string, filter interface{}, update interface{}, opts ...*options.UpdateOptions) (updateResult *UpdateResult, err error)
type UpdateResult ¶
Click to show internal directories.
Click to hide internal directories.