db

package
v0.3.9 Latest Latest
Warning

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

Go to latest
Published: May 4, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearConnector

func ClearConnector()

func Init

func Init(dbType string, dsn string, tlsConfig *tls.TLSConfig) error

func RegisterConnectorFactory

func RegisterConnectorFactory(dbType string, factory ConnectorFactory)

func RegisterMigratorFactory

func RegisterMigratorFactory(dbType string, factory MigratorFactory)

func SetDB

func SetDB(connectedDB *gorm.DB)

Types

type ConnectedConnector

type ConnectedConnector struct {
	ConnectedDB *gorm.DB
}

func (ConnectedConnector) Connect

func (c ConnectedConnector) Connect() (*gorm.DB, error)

func (ConnectedConnector) DB

func (c ConnectedConnector) DB() *gorm.DB

type Connector

type Connector interface {
	Connect() (*gorm.DB, error)
	DB() *gorm.DB
}

func GetConnector

func GetConnector() Connector

type ConnectorFactory

type ConnectorFactory func(dsn string, tlsConfig *tls.TLSConfig) Connector

type DBMigrator

type DBMigrator interface {
	Migrate() error
	Up(steps *int) error
	Down(steps *int) error
}

func NewDBMigrator

func NewDBMigrator(db *gorm.DB) (DBMigrator, error)

type MigratorFactory

type MigratorFactory func(db *gorm.DB) (DBMigrator, error)

Directories

Path Synopsis
Package drivers registers all built-in database backends (MySQL, PostgreSQL) with the platform/db connector and migrator factories.
Package drivers registers all built-in database backends (MySQL, PostgreSQL) with the platform/db connector and migrator factories.

Jump to

Keyboard shortcuts

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