constructor

package
v0.0.1-20220726-0001 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const CockroachDriver = "cockroach"
View Source
const MySQLDriver = "mysql"
View Source
const PostGRESDriver = "postgres"
View Source
const SQLiteDriver = "sqlite"

Variables

This section is empty.

Functions

func NewClient

func NewClient(
	ctx context.Context,
	c driver.Config,
) (*gorm.DB, error)

Types

type DBClient

type DBClient struct {
	DriverType string

	Ctx context.Context
	// contains filtered or unexported fields
}

func (*DBClient) GetClient

func (dbc *DBClient) GetClient(
	instanceName string,
) (*gorm.DB, error)

GetClient -> it returns an existing client

func (*DBClient) GetDefaultClient

func (dbc *DBClient) GetDefaultClient() (*gorm.DB, error)

GetDefaultClient -> it returns the default client based on the existing app configuration

func (*DBClient) GetDefaultGeneratedConfig

func (dbc *DBClient) GetDefaultGeneratedConfig() (dbDriver.Config, error)

func (*DBClient) GetDriverInstance

func (dbc *DBClient) GetDriverInstance() *dbinstance.Instance

func (*DBClient) GetInstanceConfig

func (dbc *DBClient) GetInstanceConfig(instanceName string) (dbDriver.Config, error)

func (*DBClient) New

func (dbc *DBClient) New(
	config dbDriver.Config,
) (*gorm.DB, error)

New -> Creates totally a new DB Client, this is the root function!

func (*DBClient) NewClient

func (dbc *DBClient) NewClient(
	instanceName string,
) (*gorm.DB, error)

NewClient -> it creates a new DB Client based on the existing app configuration

Jump to

Keyboard shortcuts

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