gapprdb

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2022 License: MIT Imports: 7 Imported by: 1

README

gapp-rdb

Documentation

Index

Constants

View Source
const (
	// ContainerID defines the id to be used as the container
	// registration id of a relational database connection factory instance,
	// and as a base id of all other relational database package instances
	// registered in the application container.
	ContainerID = gapp.ContainerID + ".rdb"

	// ContainerConfigID defines the id to be used as the container
	// registration id of the relational database connection configuration
	// instance.
	ContainerConfigID = ContainerID + ".config"

	// ContainerDialectStrategyTag defines the tag to be assigned to all
	// container relational database dialect strategies.
	ContainerDialectStrategyTag = ContainerID + ".dialect.strategy"

	// ContainerDialectStrategyMySQLID defines the id to be used
	// as the container registration id of the relational database connection
	// MySQL dialect instance.
	ContainerDialectStrategyMySQLID = ContainerID + ".dialect.strategy.mysql"

	// ContainerDialectStrategySqliteID defines the id to be used
	// as the container registration id of the relational database connection
	// sqlite dialect instance.
	ContainerDialectStrategySqliteID = ContainerID + ".dialect.strategy.sqlite"

	// ContainerDialectFactoryID defines the id to be used as the
	// container registration id of the relational database connection dialect
	// factory instance.
	ContainerDialectFactoryID = ContainerID + ".dialect.factory"

	// ContainerPrimaryID defines the id to be used as the container
	// registration id of primary relational database instance.
	ContainerPrimaryID = ContainerID + ".primary"
)

Variables

View Source
var (
	// ErrNilPointer defines a nil pointer argument error
	ErrNilPointer = gapp.ErrNilPointer

	// ErrConversion defines a type conversion error
	ErrConversion = gapp.ErrConversion
)
View Source
var (
	// Primary contains the name given to the primary connection.
	Primary = genv.String("GAPP_RDB_PRIMARY", "primary")
)

Functions

func GetConfig

func GetConfig(c gapp.ServiceContainer) (*gorm.Config, error)

GetConfig will try to retrieve a new default gorm config instance from the application service container.

func GetConnectionFactory

func GetConnectionFactory(c gapp.ServiceContainer) (*grdb.ConnectionFactory, error)

GetConnectionFactory will try to retrieve the registered connection factory instance from the application service container.

func GetDialectFactory

func GetDialectFactory(c gapp.ServiceContainer) (*grdb.DialectFactory, error)

GetDialectFactory will try to retrieve the registered dialect factory instance from the application service container.

func GetDialectStrategies

func GetDialectStrategies(c gapp.ServiceContainer) ([]grdb.DialectStrategy, error)

GetDialectStrategies will try to retrieve the registered the list of dialect strategies instances from the application service container.

func GetPrimaryConnection

func GetPrimaryConnection(c gapp.ServiceContainer) (*gorm.DB, error)

GetPrimaryConnection will try to retrieve the registered connection factory instance from the application service container.

Types

type Provider

type Provider struct{}

Provider @todo doc

func (Provider) Boot

func (p Provider) Boot(c gapp.ServiceContainer) error

Boot will start the rdb package

func (Provider) Register

func (p Provider) Register(c gapp.ServiceContainer) error

Register will register the rdb package instances in the application container

Jump to

Keyboard shortcuts

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