wdb

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2024 License: MIT Imports: 14 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BatchInsertCollection

func BatchInsertCollection(m *mongo.Client, db string, collection string, data []interface{}) (
	res *mongo.InsertManyResult, err error)

BatchInsertCollection 批量写入

func CountCollection

func CountCollection(m *mongo.Client, db string, collection string, filter map[string]interface{}) (int64, int64, error)

CountCollection 统计

func DeleteOneRecord

func DeleteOneRecord(m *mongo.Client, db string, collection string, filter map[string]interface{}) (
	res *mongo.DeleteResult, err error)

DeleteOneRecord 删除单条记录

func InitGormMysql

func InitGormMysql(dsn string, args ...[]int) (*gorm.DB, error)

InitGormMysql gorm 初始化mysql连接 eg: root:123456@tcp(127.0.0.1:3306)/jiaxiao?charset=utf8mb4&parseTime=True&loc=Local

func InitMongoDb

func InitMongoDb(addr string) (*mongo.Client, error)

InitMongoDb mongodb 连接

func InitRedisClient

func InitRedisClient(addr, password string, db int) (*redis.Client, error)

InitRedisClient 初始化redis 连接

func InitXormMysql

func InitXormMysql(dsn string, showSql bool, args ...[]int) (*xorm.Engine, error)

InitXormMysql xorm 初始化mysql连接

func InsertCollection

func InsertCollection(m *mongo.Client, db string, collection string, data interface{}) (
	res *mongo.InsertOneResult, err error)

InsertCollection 写入 db 写入的数据库 collection 写入的文档(表) data 写入的数据

func UpdateOneRecord

func UpdateOneRecord(m *mongo.Client, db string, collection string, id string, data bson.D) (
	res *mongo.UpdateResult, err error)

UpdateOneRecord 修改单条记录

Types

This section is empty.

Jump to

Keyboard shortcuts

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