pg

package
v2.0.17 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Postgres

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

func NewPostgres

func NewPostgres(dsn string, enableLogs bool, autoMigrateEntities []any) *Postgres

NewPostgres initializes the Postgres instance with a configurable logger

func (*Postgres) GetDB

func (p *Postgres) GetDB() *gorm.DB

GetDB returns the GORM database instance

func (*Postgres) MigrateTenants added in v2.0.11

func (p *Postgres) MigrateTenants(schemas []string, autoMigrateEntities []any) error

func (*Postgres) SeedData

func (p *Postgres) SeedData(data []any) error

SeedData populates the database with dynamic initial data

func (*Postgres) SwitchSchema added in v2.0.9

func (p *Postgres) SwitchSchema(schema string) *gorm.DB

func (*Postgres) WithTransaction

func (p *Postgres) WithTransaction(fn func(tx *gorm.DB) error) error

WithTransaction executes a function within a transaction

Jump to

Keyboard shortcuts

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