conn

package
v0.0.0-...-67d91c4 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2022 License: MIT Imports: 14 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetGorm

func GetGorm(name string) *gorm.DB

func GetMongoCollection

func GetMongoCollection(dbName, collection string) *mongo.Collection

func GetMongoDB

func GetMongoDB(dbName string) *mongo.Database

func InitMysqlDriver

func InitMysqlDriver()

func InitMysqlGorm

func InitMysqlGorm()

func MongoConn

func MongoConn() *mongo.Client

func RedisConn

func RedisConn() *redis.Pool

Types

type MongoCollection

type MongoCollection struct {
	DataBase   string
	Collection string
	Conn       *mongo.Collection
}

func NewMongoCollection

func NewMongoCollection(dbName, collection string) *MongoCollection

func (*MongoCollection) DeleteMany

func (mo *MongoCollection) DeleteMany(filter interface{}) (err error)

func (*MongoCollection) FindOne

func (mo *MongoCollection) FindOne(filter, result interface{}) (err error)

func (*MongoCollection) Get

func (mo *MongoCollection) Get() *mongo.Collection

func (*MongoCollection) InsertMany

func (mo *MongoCollection) InsertMany(value []interface{}) (err error)

func (*MongoCollection) InsertOne

func (mo *MongoCollection) InsertOne(value interface{}) (err error)

func (*MongoCollection) UpdateOne

func (mo *MongoCollection) UpdateOne(filter, update interface{}) (err error)

type MysqlDriver

type MysqlDriver struct {
	DB *sql.DB
	// contains filtered or unexported fields
}

func GetMysqlDriver

func GetMysqlDriver(dbName string) *MysqlDriver

func NewMysqlDriver

func NewMysqlDriver(database, user, password, host string) (*MysqlDriver, error)

func (*MysqlDriver) CloseLog

func (m *MysqlDriver) CloseLog()

CloseLog 关闭日志

func (*MysqlDriver) Conn

func (m *MysqlDriver) Conn() (err error)

Conn 连接mysql

func (*MysqlDriver) SetMaxIdleConn

func (m *MysqlDriver) SetMaxIdleConn(number int)

SetMaxIdleConn

func (*MysqlDriver) SetMaxOpenConn

func (m *MysqlDriver) SetMaxOpenConn(number int)

SetMaxOpenConn

Jump to

Keyboard shortcuts

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