Documentation
¶
Index ¶
- func DefaultNewClient1(c *ClientConfig, cc *Config) (es *mongo.Database, err error)
- func DefaultNewClient2(c *ClientConfig, cc *Config) (es *mongo.Database, err error)
- func OperationApiLog(c *Client, tbl, op string, args [][2]interface{}) func()
- type Client
- type ClientConfig
- type Component
- type Config
- type Operation
- func (c *Operation) AggregateAll(list interface{}, table string, pipeline interface{}, ...) error
- func (c *Operation) Count(table string, pipeline interface{}, opts ...*options.CountOptions) int64
- func (c *Operation) FindAll(list interface{}, table string, filter interface{}, ...) error
- func (c *Operation) FindOne(data interface{}, table string, filter interface{}, ...) error
- func (c *Operation) Insert(table string, data interface{}, opts ...*options.InsertOneOptions) (*mongo.InsertOneResult, error)
- func (c *Operation) Update(table string, filter, data interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultNewClient1 ¶
func DefaultNewClient1(c *ClientConfig, cc *Config) (es *mongo.Database, err error)
func DefaultNewClient2 ¶
func DefaultNewClient2(c *ClientConfig, cc *Config) (es *mongo.Database, err error)
func OperationApiLog ¶ added in v0.1.2
Types ¶
type Client ¶
type Client struct {
Client *mongo.Database
Cfg ClientConfig
Log logger.Interface
CreateClient func(c *ClientConfig, cc *Config) (es *mongo.Database, err error)
// contains filtered or unexported fields
}
type ClientConfig ¶
type ClientConfig struct {
Host string `json:"host" yaml:"host"`
User string `json:"user" yaml:"user"`
Pwd string `json:"password" yaml:"password"`
DB string `json:"db" yaml:"db"`
DSN string `json:"dsn" yaml:"dsn"`
Options string `json:"options" yaml:"options"`
MinPoolSize int `json:"min_pool_size" yaml:"min_pool_size"`
MaxPoolSize int `json:"max_pool_size" yaml:"max_pool_size"`
}
type Operation ¶
type Operation struct {
ApiLog func(c *Client, tbl, op string, args [][2]interface{}) func()
// contains filtered or unexported fields
}
func NewOperation ¶
func (*Operation) AggregateAll ¶
func (c *Operation) AggregateAll(list interface{}, table string, pipeline interface{}, opts ...*options.AggregateOptions) error
func (*Operation) Count ¶
func (c *Operation) Count(table string, pipeline interface{}, opts ...*options.CountOptions) int64
func (*Operation) FindAll ¶
func (c *Operation) FindAll(list interface{}, table string, filter interface{}, opts ...*options.FindOptions) error
func (*Operation) FindOne ¶
func (c *Operation) FindOne(data interface{}, table string, filter interface{}, opts ...*options.FindOneOptions) error
func (*Operation) Insert ¶
func (c *Operation) Insert(table string, data interface{}, opts ...*options.InsertOneOptions) (*mongo.InsertOneResult, error)
func (*Operation) Update ¶
func (c *Operation) Update(table string, filter, data interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)
Click to show internal directories.
Click to hide internal directories.