Documentation ¶
Index ¶
- type Client
- func (c *Client) Aggregate(ctx context.Context, tableName string, groupStage mongo.Pipeline) ([]bson.M, error)
- func (c *Client) DeleteOne(ctx context.Context, tableName string, filter interface{}) error
- func (c *Client) Disconnect(ctx context.Context) error
- func (c *Client) Find(ctx context.Context, tableName string, filters ...interface{}) ([]bson.M, error)
- func (c *Client) FindOne(ctx context.Context, tableName string, filter interface{}) *mongo.SingleResult
- func (c *Client) InsertOne(ctx context.Context, tableName string, filter interface{}) (interface{}, error)
- func (c *Client) Ping(ctx context.Context) error
- func (c *Client) UpdateOne(ctx context.Context, tableName string, filter, update interface{}) (*mongo.UpdateResult, error)
- type MongoDBConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func GetClient ¶
func GetClient(dbCig *MongoDBConfig, ctx context.Context) (*Client, error)
GetClient ctx, cancel := context.WithTimeout(context.Background(), CONFIG.Timeout*time.Second)
type MongoDBConfig ¶
type MongoDBConfig struct { Timeout time.Duration `mapstructure:"timeout" json:"timeout" yaml:"timeout"` DB string `mapstructure:"db" json:"db" yaml:"db"` Addr string `mapstructure:"addr" json:"addr" yaml:"addr"` }
func (*MongoDBConfig) GetApplyURI ¶
func (md *MongoDBConfig) GetApplyURI() string
Click to show internal directories.
Click to hide internal directories.