gormds

package module
v0.0.0-...-ed03793 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidConnection = errors.New("invalid connection")
	ErrInvalidDriver     = errors.New("invalid driver")
)

Functions

func ProvideDB

func ProvideDB(connector *Connector) (*gorm.DB, error)

Types

type ConnectionConfig

type ConnectionConfig struct {
	Driver   string
	Host     string
	Port     int
	Database string
	Username string
	Password string
}

type Connector

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

func NewConnector

func NewConnector(configGetter GORMConfigGetter) *Connector

func (Connector) DB

func (c Connector) DB() (*gorm.DB, error)

func (Connector) DBWith

func (c Connector) DBWith(name string) (*gorm.DB, error)

type ConnectorOptions

type ConnectorOptions struct {
	Logger *zerolog.Logger
}

type GORMConfig

type GORMConfig struct {
	Logging           LoggingConfig
	DefaultConnection string
	Connections       map[string]ConnectionConfig
}

type GORMConfigGetter

type GORMConfigGetter interface {
	GetGORMConfig() *GORMConfig
}

type LoggingConfig

type LoggingConfig struct {
	SlowThreshold             string
	IgnoreRecordNotFoundError bool
	LogLevel                  string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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