Class MetaUtils
java.lang.Object
org.pgcodekeeper.core.schema.meta.MetaUtils
Utility class for creating and managing database metadata objects.
Provides methods for converting database statements to metadata representations
and organizing them into metadata containers.
-
Method Summary
Modifier and TypeMethodDescriptionstatic MetaContainerCreates a metadata container from a database object.static MetaContainercreateTreeFromDefs(Stream<MetaStatement> defs, DatabaseType dbType, SupportedPgVersion version) Creates a metadata container from a stream of metadata definitions.static Map<String,List<MetaStatement>> Returns object definitions grouped by file path.static voidinitializeView(MetaContainer meta, String schemaName, String name, List<? extends Pair<String, String>> columns) Initializes a view with column information in the metadata container.
-
Method Details
-
createTreeFromDb
Creates a metadata container from a database object.- Parameters:
db- the database object- Returns:
- the metadata container with all database objects
-
createTreeFromDefs
public static MetaContainer createTreeFromDefs(Stream<MetaStatement> defs, DatabaseType dbType, SupportedPgVersion version) Creates a metadata container from a stream of metadata definitions.- Parameters:
defs- the stream of metadata statementsdbType- the database typeversion- the PostgreSQL version (used only for PG databases)- Returns:
- the metadata container with all definitions
-
getObjDefinitions
Returns object definitions grouped by file path.- Parameters:
db- the database object- Returns:
- map of file paths to lists of metadata statements
-
initializeView
public static void initializeView(MetaContainer meta, String schemaName, String name, List<? extends Pair<String, String>> columns) Initializes a view with column information in the metadata container.- Parameters:
meta- the metadata containerschemaName- the schema namename- the view namecolumns- the list of column name-type pairs
-