db

package
v0.0.0-...-d32eb86 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(opts *Options) (*gorm.DB, error)

New create a new gorm db instance with the given options.

Types

type Options

type Options struct {
	Host                  string
	Username              string
	Password              string
	Database              string
	MaxIdleConnections    int
	MaxOpenConnections    int
	MaxConnectionLifeTime time.Duration
	LogLevel              int
	Logger                logger.Interface
}

Options defines optsions for mysql database.

type TracePlugin

type TracePlugin struct{}

TracePlugin is a GORM plugin to trace the execution time of SQL statements.

func (*TracePlugin) Initialize

func (op *TracePlugin) Initialize(db *gorm.DB) (err error)

Initialize registers the callbacks to measure SQL execution time.

func (*TracePlugin) Name

func (op *TracePlugin) Name() string

Name returns the name of the trace plugin.

Jump to

Keyboard shortcuts

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