postgres

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Default *gorm.DB
)

Functions

func Exec

func Exec(sql string, values any) error

func Init

func Init() (err error)

Init initializes the default PostgreSQL connection. It checks if PostgreSQL is enabled and selected as the default database. If the connection is successful, it initializes the database and returns nil.

func New added in v0.1.1

func New(cfg config.Postgres) (*gorm.DB, error)

New creates and returns a new PostgreSQL database connection with the given configuration. Returns (*gorm.DB, error) where error is non-nil if the connection fails.

func Transaction

func Transaction(fn func(tx *gorm.DB) error) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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