Help us shape the future of Go! Take the 2026 Go Developer Survey

db

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2022 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 2 more Imports: 6 Imported by: 0

Documentation

Overview

Package db provide useful functions to create mysql instance.

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 defines gorm plugin used to trace sql.

func (*TracePlugin) Initialize

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

Initialize initialize the trace plugin.

func (*TracePlugin) Name

func (op *TracePlugin) Name() string

Name returns the name of trace plugin.

Jump to

Keyboard shortcuts

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