postgresql

package
v1.12.1 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package postgresql provides a gorm driver for postgresql.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close(db *gorm.DB) error

Close close gorm db

func Init

func Init(dsn string, opts ...Option) (*gorm.DB, error)

Init postgresql

Types

type Option

type Option func(*options)

Option set the mysql options.

func WithConnMaxLifetime

func WithConnMaxLifetime(t time.Duration) Option

WithConnMaxLifetime set conn max lifetime

func WithEnableForeignKey

func WithEnableForeignKey() Option

WithEnableForeignKey use foreign keys

func WithEnableTrace

func WithEnableTrace() Option

WithEnableTrace use trace

func WithGormPlugin

func WithGormPlugin(plugins ...gorm.Plugin) Option

WithGormPlugin setting gorm plugin

func WithLogRequestIDKey

func WithLogRequestIDKey(key string) Option

WithLogRequestIDKey log request id

func WithLogging

func WithLogging(l *zap.Logger, level ...logger.LogLevel) Option

WithLogging set log sql, If l=nil, the gorm log library will be used

func WithMaxIdleConns

func WithMaxIdleConns(size int) Option

WithMaxIdleConns set max idle conns

func WithMaxOpenConns

func WithMaxOpenConns(size int) Option

WithMaxOpenConns set max open conns

func WithSlowThreshold

func WithSlowThreshold(d time.Duration) Option

WithSlowThreshold Set sql values greater than the threshold

Jump to

Keyboard shortcuts

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