postgresql

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGorm

func NewGorm(v *viper.Viper, opts ...Options) (*gorm.DB, error)

NewGorm init new GORM using postgresql as the db and given viper config to get detailed information about the db such as host, port, username etc.

Types

type Options

type Options func(*gorm.Config)

func WithCustomLogger

func WithCustomLogger(l logger.Interface) Options

WithCustomLogger use the given logger implementation as GORM logger.

func WithDisableForeignKeyWhenMigrating

func WithDisableForeignKeyWhenMigrating() Options

WithDisableForeignKeyWhenMigrating disable foreign key constraint when using GORM's migration.

func WithDisableNestedTrx

func WithDisableNestedTrx() Options

WithDisableNestedTrx disable default nested transaction.

func WithPrepareStatement

func WithPrepareStatement() Options

WithPrepareStatement enable prepared statement for GORM.

Refer to https://gorm.io/docs/session.html#PrepareStmt.

func WithSingularTableName

func WithSingularTableName() Options

WithSingularTableName set all tables name to singular.

func WithSkipDefaultTrx

func WithSkipDefaultTrx() Options

WithSkipDefaultTrx skip default transaction.

Jump to

Keyboard shortcuts

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