utils

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectDB

func ConnectDB(cfg *config.ConnectionConfig) (*sql.DB, error)

ConnectDB opens a database connection, pings it, and sets sensible defaults.

func FormatBytes

func FormatBytes(bytes uint64) string

FormatBytes converts bytes to a human-readable string (e.g., "12.5 MB")

func ListDatabaseSizesQuery added in v0.4.1

func ListDatabaseSizesQuery(dbType config.DBType) string

ListDatabaseSizesQuery returns the SQL to list databases with their estimated sizes.

func ListDatabasesQuery added in v0.4.1

func ListDatabasesQuery(dbType config.DBType) string

ListDatabasesQuery returns the SQL to list databases in a server instance.

func ListObjectsQuery added in v0.4.1

func ListObjectsQuery(dbType config.DBType, objType DBObjectType) string

ListObjectsQuery returns the SQL to list objects of a given type, or "" if unsupported.

func ListTablesQuery

func ListTablesQuery(dbType config.DBType) string

ListTablesQuery returns the appropriate SQL to list user tables for a DB type

Types

type DBObjectType added in v0.4.1

type DBObjectType string

DBObjectType represents a category of database objects for introspection.

const (
	ObjViews            DBObjectType = "Views"
	ObjFunctions        DBObjectType = "Functions"
	ObjTriggers         DBObjectType = "Triggers"
	ObjStoredProcedures DBObjectType = "Procedures"
	ObjExtensions       DBObjectType = "Extensions"
)

func SupportedObjectTypes added in v0.4.1

func SupportedObjectTypes(dbType config.DBType) []DBObjectType

SupportedObjectTypes returns the object types supported for introspection by a DB type.

Jump to

Keyboard shortcuts

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