postgresgorm

package
v0.0.0-...-258ee92 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Module = fx.Module(
	"gormpostgresfx",
	fx.Provide(
		provideConfig,
		NewGorm,
		NewSQLDB,

		fx.Annotate(
			NewGormHealthChecker,
			fx.As(new(contracts.Health)),
			fx.ResultTags(fmt.Sprintf(`group:"%s"`, "healths")),
		),
	),
)

Functions

func NewGorm

func NewGorm(cfg *GormOptions) (*gorm.DB, error)

func NewGormHealthChecker

func NewGormHealthChecker(client *sql.DB) contracts.Health

func NewSQLDB

func NewSQLDB(orm *gorm.DB) (*sql.DB, error)

Types

type GormOptions

type GormOptions struct {
	UseInMemory   bool   `mapstructure:"useInMemory" json:"useInMemory"`
	UseSQLLite    bool   `mapstructure:"useSqlLite" json:"useSqlLite"`
	Host          string `mapstructure:"host" json:"host"`
	Port          int    `mapstructure:"port" json:"port"`
	User          string `mapstructure:"user" json:"user"`
	DBName        string `mapstructure:"dbName" json:"dbName"`
	SSLMode       bool   `mapstructure:"sslMode" json:"sslMode"`
	Password      string `mapstructure:"password" json:"password"`
	EnableTracing bool   `mapstructure:"enableTracing" default:"true" json:"enableTracing"`
}

func (*GormOptions) Dns

func (h *GormOptions) Dns() string

Directories

Path Synopsis
helpers

Jump to

Keyboard shortcuts

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