gorm

package module
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package gorm provides a GORM plugin that records generated SQL as webpprof Query entries.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Profile

func Profile(db *gorm.DB, configs ...Config) error

Profile installs the plugin on db using the default profiler.

func ProfileWith

func ProfileWith(profiler *webpprof.Profiler, db *gorm.DB, configs ...Config) error

ProfileWith installs the plugin on db using an explicit profiler.

Types

type Config

type Config struct {
	Connection     string
	Database       string
	Explain        bool
	ExplainTimeout time.Duration
	ExplainMaxRows int
}

Config names the connection and database shown in captured Query entries and controls optional non-executing EXPLAIN capture.

type Plugin

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

Plugin implements gorm.Plugin.

func New

func New(configs ...Config) *Plugin

New creates a plugin using the default webpprof profiler.

func NewWith

func NewWith(profiler *webpprof.Profiler, configs ...Config) *Plugin

NewWith creates a plugin using an explicit profiler.

func (*Plugin) Initialize

func (p *Plugin) Initialize(db *gorm.DB) error

Initialize registers callbacks around every SQL-producing GORM operation.

func (*Plugin) Name

func (*Plugin) Name() string

Name identifies the plugin in GORM's plugin registry.

Jump to

Keyboard shortcuts

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