sql

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Auto

func Auto()

func DoNothingOnConflict

func DoNothingOnConflict() clause.OnConflict

func Get

func Get(ctx context.Context) *gorm.DB

func IfNotFound

func IfNotFound(tx *gorm.DB) error

func OrderByCreatedAt

func OrderByCreatedAt(desc ...bool) func(*gorm.DB) *gorm.DB

func OrderByUpdatedAt

func OrderByUpdatedAt(desc ...bool) func(*gorm.DB) *gorm.DB

func Ping

func Ping(ctx context.Context) error

Types

type Stats

type Stats struct {
	MaxOpenConnections int `json:"max_open_connections,omitempty"` // Maximum number of open connections to the database.

	// Pool Status
	OpenConnections int `json:"open_connections,omitempty"` // The number of established connections both in use and idle.
	InUse           int `json:"in_use,omitempty"`           // The number of connections currently in use.
	Idle            int `json:"idle,omitempty"`             // The number of idle connections.

	// Counters
	WaitCount         int64         `json:"wait_count,omitempty"`           // The total number of connections waited for.
	WaitDuration      time.Duration `json:"wait_duration,omitempty"`        // The total time blocked waiting for a new connection.
	MaxIdleClosed     int64         `json:"max_idle_closed,omitempty"`      // The total number of connections closed due to SetMaxIdleConns.
	MaxIdleTimeClosed int64         `json:"max_idle_time_closed,omitempty"` // The total number of connections closed due to SetConnMaxIdleTime.
	MaxLifetimeClosed int64         `json:"max_lifetime_closed,omitempty"`  // The total number of connections closed due to SetConnMaxLifetime.
}

Stats contains database statistics.

func GetStats

func GetStats() Stats

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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