gorm

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Callback added in v0.1.0

type Callback struct {
	// contains filtered or unexported fields
}

func NewCallback added in v0.1.0

func NewCallback(dbName string, opts ...Option) *Callback

func (*Callback) Register added in v0.1.0

func (c *Callback) Register(db *gorm.DB) (err error)

type DBStats

type DBStats struct {
	// contains filtered or unexported fields
}

func NewStats

func NewStats(dbName string, opts ...Option) *DBStats

func (*DBStats) StartStats

func (s *DBStats) StartStats(db *gorm.DB)

type Option

type Option func(*Options)

func WithDurationBuckets

func WithDurationBuckets(buckets []float64) Option

WithDurationBuckets sets the duration buckets of single commands metrics.

func WithNamespace

func WithNamespace(namespace string) Option

WithNamespace sets the namespace of all metrics.

func WithStatInterval

func WithStatInterval(interval time.Duration) Option

WithStatInterval sets the duration buckets of single commands metrics.

func WithSubsystem

func WithSubsystem(subsystem string) Option

WithSubsystem sets the namespace of all metrics.

type Options

type Options struct {
	Namespace       string
	Subsystem       string
	DurationBuckets []float64
	StatInterval    time.Duration
}

Options represents options to customize the exported metrics.

func DefaultOptions

func DefaultOptions() *Options

DefaultOptions returns the default options.

func (*Options) Merge

func (options *Options) Merge(opts ...Option)

Jump to

Keyboard shortcuts

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