database

package
v0.0.0-...-d1c7448 Latest Latest
Warning

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

Go to latest
Published: May 30, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InstancePostgres int = iota
	InstanceMongo
)

Variables

This section is empty.

Functions

func NewMongoDB

func NewMongoDB(client *mongo.Client, database string, timeout time.Duration) *mongoDB

NewMongoDB creates an instance of mongoDB type

Types

type Db

type Db struct {
	Pool  *pgxpool.Pool
	Mongo *mongo.Client
}

func ConnectMongoDB

func ConnectMongoDB(c *databaseConfig) (*Db, error)

ConnectMongoDB connects the mongodb and returns Db type and assigns the mongodb client to the Db client field

func ConnectPostgres

func ConnectPostgres(c *databaseConfig) (*Db, error)

ConnectPostgres connects to the postgres database pool and assigns it the Db struct pool field returning Db

func NewDatabaseFactory

func NewDatabaseFactory(instance int) (*Db, error)

NewDatabaseFactory returns Db type based of the db instance provided

type Postgres

type Postgres struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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