Documentation ¶
Index ¶
- Variables
- type Collection
- func (m *Collection) Count(filter interface{}) (int64, error)
- func (m *Collection) Delete(filter interface{}) (int64, error)
- func (m *Collection) Find(p *Page, filter interface{}, result interface{}) error
- func (m *Collection) FindById(id string, result interface{}) error
- func (m *Collection) FindOne(filter interface{}, result interface{}) error
- func (m *Collection) Insert(docs ...interface{}) ([]interface{}, error)
- func (m *Collection) Update(filter, update interface{}) (int64, error)
- type MongoClient
- type MongoConfig
- type MongoType
- type Page
- type ReplicaSetConfig
- type ShardClusterConfig
- type StandaloneConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultPage = &Page{Limit: 10, Skip: 0, Sort: bson.M{"_id": -1}}
Functions ¶
This section is empty.
Types ¶
type Collection ¶
type Collection struct { Client *MongoClient Collection *mongo.Collection ColName string }
func NewCollection ¶
func NewCollection(mc *MongoClient, colName string) *Collection
func (*Collection) Count ¶
func (m *Collection) Count(filter interface{}) (int64, error)
func (*Collection) Delete ¶
func (m *Collection) Delete(filter interface{}) (int64, error)
func (*Collection) Find ¶
func (m *Collection) Find(p *Page, filter interface{}, result interface{}) error
func (*Collection) FindById ¶
func (m *Collection) FindById(id string, result interface{}) error
func (*Collection) FindOne ¶
func (m *Collection) FindOne(filter interface{}, result interface{}) error
func (*Collection) Insert ¶
func (m *Collection) Insert(docs ...interface{}) ([]interface{}, error)
func (*Collection) Update ¶
func (m *Collection) Update(filter, update interface{}) (int64, error)
type MongoClient ¶
type MongoConfig ¶
type MongoConfig struct { Type MongoType `json:"type"` URI string `json:"uri"` DBName string `json:"dbName"` Standalone StandaloneConfig `json:"standalone"` ReplicaSet ReplicaSetConfig `json:"replicaSet"` ShardCluster ShardClusterConfig `json:"shardCluster"` MaxPoolSize uint64 `json:"maxPoolSize"` MinPoolSize uint64 `json:"minPoolSize"` MaxConnIdleTime time.Duration `json:"maxConnIdleTime"` SocketTimeout time.Duration `json:"socketTimeout"` }
func GetDefaultMongoConfig ¶
func GetDefaultMongoConfig() *MongoConfig
func GetMongoConfig ¶
func GetMongoConfig(key string) *MongoConfig
func (*MongoConfig) NewClient ¶
func (mongoConfig *MongoConfig) NewClient() *MongoClient
type ReplicaSetConfig ¶
type ReplicaSetConfig struct {
ReplicaName string `json:"replicaName"`
}
type ShardClusterConfig ¶
type ShardClusterConfig struct { }
type StandaloneConfig ¶
type StandaloneConfig struct { }
Click to show internal directories.
Click to hide internal directories.