mgdb

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 9, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

*------------------------------------------------------------**

  • @filename mgdb/config.go
  • @author jinycoo - caojingyin@jinycoo.com
  • @version 1.0.0
  • @date 2019/11/13 14:47
  • @desc mgdb - mongodb config **------------------------------------------------------------*

*------------------------------------------------------------**

  • @filename mgdb/mg.go
  • @author jinycoo - caojingyin@jinycoo.com
  • @version 1.0.0
  • @date 2019/11/13 14:46
  • @desc mgdb - mongodb conn **------------------------------------------------------------*

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Addr         string // for trace
	DSN          string // write data source name.
	Username     string
	Password     string
	Timeout      ctime.Duration
	Database     string
	IdleTimeout  ctime.Duration // connect max life time.
	QueryTimeout ctime.Duration // query sql timeout
	ExecTimeout  ctime.Duration // execute sql timeout
}

type DB

type DB struct {
	ClientDB *mongo.Database
	// contains filtered or unexported fields
}

func NewMgDB

func NewMgDB(c *Config) (db *DB)

func (*DB) Close

func (mg *DB) Close() error

func (*DB) Ping

func (mg *DB) Ping(ctx context.Context) (err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL