mcdb

package module
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2020 License: MIT Imports: 12 Imported by: 0

README

mcdb | github.com/abbeymart/mcdbgo

  • Db Connection module/packages for PostgresSQL, SQLite3 and MongoDB
  • PostgresSQL: used go-database/sql & github.com/lib/pq, and pgx/pgxpool package
  • SQLite3: used go-database/sql & github.com/mattn/go-sqlite3
  • MongoDB: used go.mongodb.org/mongo-driver/mongo
  • See test files for test cases / scenarios

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Db added in v0.2.0

type Db struct {
	DbConn *pgx.Conn
}

type DbConfig

type DbConfig struct {
	DbType       string
	Host         string
	Username     string
	Password     string
	DbName       string
	Filename     string
	Location     string
	Port         uint32
	PoolSize     uint
	Url          string
	SecureOption DbSecureType
	Options      DbConnectOptions
}

func (DbConfig) CloseDb

func (dbConfig DbConfig) CloseDb()

func (DbConfig) ClosePgxDb added in v0.2.0

func (dbConfig DbConfig) ClosePgxDb()

func (DbConfig) ClosePgxDbPool added in v0.2.0

func (dbConfig DbConfig) ClosePgxDbPool()

func (DbConfig) OpenDb

func (dbConfig DbConfig) OpenDb() (*sql.DB, error)

func (DbConfig) OpenPgxDb added in v0.2.0

func (dbConfig DbConfig) OpenPgxDb() (*Db, error)

func (DbConfig) OpenPgxDbPool added in v0.2.0

func (dbConfig DbConfig) OpenPgxDbPool() (*DbPool, error)

type DbConfigType

type DbConfigType struct {
	Host         string
	Username     string
	Password     string
	DbName       string
	Filename     string
	Location     string
	Port         uint32
	DbType       string
	PoolSize     uint
	Url          string
	SecureOption DbSecureType
}

type DbConnectOptions

type DbConnectOptions map[string]interface{}

type DbConnectionType

type DbConnectionType *sql.DB

type DbPool added in v0.2.0

type DbPool struct {
	DbConn *pgxpool.Pool
}

type DbSecureType

type DbSecureType struct {
	SecureAccess bool
	SecureCert   string
	SecureKey    string
}

type MongoDbConfig added in v0.1.1

type MongoDbConfig struct {
	DbType   string
	Host     string
	Username string
	Password string
	DbName   string
	Filename string
	Location string
	Port     uint32
	PoolSize uint
	Url      string
	Options  MongoDbConnectOptions
}

func (MongoDbConfig) CloseMongoDb added in v0.1.1

func (dbConfig MongoDbConfig) CloseMongoDb()

func (MongoDbConfig) OpenMongoDb added in v0.1.1

func (dbConfig MongoDbConfig) OpenMongoDb() (*mongo.Client, error)

type MongoDbConfigType added in v0.1.1

type MongoDbConfigType struct {
	Host         string
	Username     string
	Password     string
	DbName       string
	Filename     string
	Location     string
	Port         uint32
	DbType       string
	PoolSize     uint
	SecureOption MongoDbSecureType
	Uri          string
}

type MongoDbConnectOptions added in v0.1.1

type MongoDbConnectOptions map[string]interface{}

type MongoDbConnectionType added in v0.1.1

type MongoDbConnectionType *mongo.Client

type MongoDbSecureType added in v0.1.1

type MongoDbSecureType struct {
	SecureAccess bool
	SecureCert   string
	SecureKey    string
}

Jump to

Keyboard shortcuts

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