database

package
v0.0.0-...-f9f7919 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2024 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetTransactionFunc

func GetTransactionFunc(db *gorm.DB) (TransactionFunc, Dialect, error)

func IsDuplicateError

func IsDuplicateError(err error) bool

func Migrations

func Migrations() *migrations.Migrations

Migrations gormigrate is a wrapper for gorm's migration functions that adds schema versioning and rollback capabilities. For help writing migration steps, see the gorm documentation on migrations: https://gorm.io/docs/migration.html

func NewDatabase

func NewDatabase(
	parent context.Context,
	logger *zap.SugaredLogger,
	host string,
	user string,
	password string,
	dbname string,
	port string,
	sslmode string,
) (*gorm.DB, string, error)

func NewLogger

func NewLogger(sugar *zap.SugaredLogger) *zapLogger

func NewTestDatabase

func NewTestDatabase() (*gorm.DB, error)

func Silent

func Silent(db *gorm.DB) *gorm.DB

Types

type Dialect

type Dialect int
const (
	DialectSqlLite Dialect = iota
	DialectPostgreSQL
	DialectCockroachDB
)

type TransactionFunc

type TransactionFunc func(
	ctx context.Context, fn func(tx *gorm.DB) error, opts ...*sql.TxOptions,
) error

Jump to

Keyboard shortcuts

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