dbcore

package
v0.0.0-...-32509ee Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigDatabaseForTesting

func ConfigDatabaseForTesting() *gorm.DB

func ConnectPostgres

func ConnectPostgres(cfg DBConfig) (*gorm.DB, error)

func CreateDefaultTenantAndDatabase

func CreateDefaultTenantAndDatabase(db *gorm.DB) string

func CreateTestTables

func CreateTestTables(db *gorm.DB)

func CtxWithTransaction

func CtxWithTransaction(ctx context.Context, tx *gorm.DB) context.Context

func GetDB

func GetDB(ctx context.Context) *gorm.DB

func NewTxImpl

func NewTxImpl() *txImpl

func SetGlobalDB

func SetGlobalDB(db *gorm.DB)

SetGlobalDB Only for test

Types

type DBConfig

type DBConfig struct {
	Username     string
	Password     string
	Address      string
	Port         int
	DBName       string
	MaxIdleConns int
	MaxOpenConns int
	SslMode      string
}

func GetDBConfigForTesting

func GetDBConfigForTesting() DBConfig

Jump to

Keyboard shortcuts

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