database

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DB     *gorm.DB
	DBSite *gorm.DB
)
View Source
var ErrNotInitialized = &errNotInitialized{}

Functions

func Cleanup

func Cleanup() error

func CreateDatabaseConnection

func CreateDatabaseConnection(cfg *config.DatabaseConfiguration) (*gorm.DB, error)

func GetDB

func GetDB() *gorm.DB

func GetDBSite

func GetDBSite() *gorm.DB

func HealthCheck added in v0.1.14

func HealthCheck(ctx context.Context) error

func IsAlive added in v0.1.14

func IsAlive() bool

func NewFintechLogger added in v0.2.0

func NewFintechLogger(cfg logger.Config) logger.Interface

func Setup

func Setup() error

Types

type Database

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

func New added in v0.2.0

func New(cfg *config.DatabaseConfiguration, opts Options, override ...Option) (*Database, error)

func NewContext added in v0.2.0

func NewContext(ctx context.Context, cfg *config.DatabaseConfiguration, opts Options, override ...Option) (*Database, error)

func (*Database) Close added in v0.2.0

func (d *Database) Close() error

func (*Database) DB added in v0.2.0

func (d *Database) DB() *gorm.DB

func (*Database) Health added in v0.2.0

func (d *Database) Health(ctx context.Context) error

type Option added in v0.2.0

type Option func(*Options)

func WithConnMaxIdleTime added in v0.2.0

func WithConnMaxIdleTime(d time.Duration) Option

func WithConnMaxLifetime added in v0.2.0

func WithConnMaxLifetime(d time.Duration) Option

func WithIAM added in v0.2.0

func WithIAM(v bool) Option

func WithLogLevel added in v0.2.0

func WithLogLevel(level logger.LogLevel) Option

func WithMaxIdleConns added in v0.2.0

func WithMaxIdleConns(n int) Option

func WithMaxOpenConns added in v0.2.0

func WithMaxOpenConns(n int) Option

func WithPrivateIP added in v0.2.0

func WithPrivateIP(v bool) Option

type Options added in v0.2.0

type Options struct {
	UseIAM        bool
	UsePrivateIP  bool
	LogLevel      logger.LogLevel
	MaxOpenConns  int
	MaxIdleConns  int
	ConnMaxLife   time.Duration
	ConnMaxIdle   time.Duration
	SlowThreshold time.Duration
	PingTimeout   time.Duration
}

Jump to

Keyboard shortcuts

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