dbmanager

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2026 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package dbmanager provides a database management module for executing SQL queries. This module allows administrators to run arbitrary SQL queries and view results. Access is restricted to admin users only.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DashboardData

type DashboardData struct {
	Query   string
	Result  *QueryResult
	History []QueryHistoryItem
}

DashboardData contains data for the database manager dashboard template.

type Module

type Module struct {
	module.BaseModule
	// contains filtered or unexported fields
}

Module implements the module.Module interface for the database manager module.

func New

func New() *Module

New creates a new instance of the database manager module.

func (*Module) AdminURL

func (m *Module) AdminURL() string

AdminURL returns the admin dashboard URL for the module.

func (*Module) Init

func (m *Module) Init(ctx *module.Context) error

Init initializes the module with the given context.

func (*Module) Migrations

func (m *Module) Migrations() []module.Migration

Migrations returns database migrations for the module.

func (*Module) RegisterAdminRoutes

func (m *Module) RegisterAdminRoutes(r chi.Router)

RegisterAdminRoutes registers admin routes for the module.

func (*Module) RegisterRoutes

func (m *Module) RegisterRoutes(_ chi.Router)

RegisterRoutes registers public routes for the module.

func (*Module) Shutdown

func (m *Module) Shutdown() error

Shutdown performs cleanup when the module is shutting down.

func (*Module) SidebarLabel

func (m *Module) SidebarLabel() string

SidebarLabel returns the display label for the admin sidebar.

func (*Module) TemplateFuncs

func (m *Module) TemplateFuncs() template.FuncMap

TemplateFuncs returns template functions provided by the module.

func (*Module) TranslationsFS

func (m *Module) TranslationsFS() embed.FS

TranslationsFS returns the embedded filesystem containing module translations.

type QueryHistoryItem

type QueryHistoryItem struct {
	ID            int64
	Query         string
	UserID        int64
	ExecutedAt    time.Time
	RowsAffected  int
	ExecutionTime int
	Error         sql.NullString
}

QueryHistoryItem represents a single query execution in history.

type QueryResult

type QueryResult struct {
	Columns      []string
	Rows         [][]string
	RowsAffected int64
	ExecutionMs  int64
	Error        string
	IsSelect     bool
}

QueryResult contains the result of a SQL query execution.

Jump to

Keyboard shortcuts

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