util

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterSchema

FilterSchema applies filtering options to a database schema and returns a new filtered schema.

Types

type FilterOptions

type FilterOptions struct {
	// IncludeSchemas includes only these schemas (empty = all)
	IncludeSchemas []string
	// ExcludeSchemas excludes these schemas
	ExcludeSchemas []string

	// IncludeTables includes only tables matching these patterns
	IncludeTables []*regexp.Regexp
	// ExcludeTables excludes tables matching these patterns
	ExcludeTables []*regexp.Regexp

	// IncludeViews includes only views matching these patterns
	IncludeViews []*regexp.Regexp
	// ExcludeViews excludes views matching these patterns
	ExcludeViews []*regexp.Regexp

	// IncludeFunctions includes only functions matching these patterns
	IncludeFunctions []*regexp.Regexp
	// ExcludeFunctions excludes functions matching these patterns
	ExcludeFunctions []*regexp.Regexp

	// TableMinSize filters tables smaller than this size in bytes (0 = no filter)
	TableMinSize int64
	// TableMaxSize filters tables larger than this size in bytes (0 = no filter)
	TableMaxSize int64

	// RemoveEmptySchemas removes schemas with no objects after filtering
	RemoveEmptySchemas bool
}

FilterOptions configures schema filtering.

func CombineFilters

func CombineFilters(filters ...*FilterOptions) *FilterOptions

CombineFilters combines multiple filter options into one. Later filters take precedence over earlier ones for conflicting settings.

func ExcludeSystemSchemas

func ExcludeSystemSchemas() *FilterOptions

ExcludeSystemSchemas creates a filter that excludes common system schemas. For PostgreSQL: pg_catalog, information_schema, pg_toast For MySQL: mysql, information_schema, performance_schema, sys

func ExcludeTestTables

func ExcludeTestTables() *FilterOptions

ExcludeTestTables creates a filter that excludes tables commonly used for testing.

func FilterByPrefix

func FilterByPrefix(prefix string) *FilterOptions

FilterByPrefix creates a filter that includes only objects with the given prefix.

func FilterBySchema

func FilterBySchema(schemas ...string) *FilterOptions

FilterBySchema creates a filter that includes only the specified schemas.

func FilterBySize

func FilterBySize(minBytes, maxBytes int64) *FilterOptions

FilterBySize creates a filter that includes only tables within the specified size range.

func FilterBySuffix

func FilterBySuffix(suffix string) *FilterOptions

FilterBySuffix creates a filter that includes only objects with the given suffix.

func NewFilterOptions

func NewFilterOptions() *FilterOptions

NewFilterOptions creates a new FilterOptions with default values.

func (*FilterOptions) Summary

func (opts *FilterOptions) Summary() string

Summary returns a human-readable summary of the filter configuration.

func (*FilterOptions) WithExcludeSchemas

func (opts *FilterOptions) WithExcludeSchemas(schemas ...string) *FilterOptions

WithExcludeSchemas sets the schemas to exclude.

func (*FilterOptions) WithExcludeTablesPattern

func (opts *FilterOptions) WithExcludeTablesPattern(pattern string) *FilterOptions

WithExcludeTablesPattern adds a table name pattern to exclude.

func (*FilterOptions) WithIncludeSchemas

func (opts *FilterOptions) WithIncludeSchemas(schemas ...string) *FilterOptions

WithIncludeSchemas sets the schemas to include.

func (*FilterOptions) WithIncludeTablesPattern

func (opts *FilterOptions) WithIncludeTablesPattern(pattern string) *FilterOptions

WithIncludeTablesPattern adds a table name pattern to include.

func (*FilterOptions) WithRemoveEmptySchemas

func (opts *FilterOptions) WithRemoveEmptySchemas(remove bool) *FilterOptions

WithRemoveEmptySchemas sets whether to remove empty schemas after filtering.

func (*FilterOptions) WithTableSizeRange

func (opts *FilterOptions) WithTableSizeRange(minSize, maxSize int64) *FilterOptions

WithTableSizeRange sets the minimum and maximum table sizes in bytes.

Jump to

Keyboard shortcuts

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