Repository navigation
DiGi.PostgreSQL.Table
public static class ConvertInheritance System.Object → Convert
Converts a column implementation to a DiGi core column representation.
public static DiGi.PostgreSQL.Table.Classes.Column? ToDiGi<UColumn>(this UColumn? column)
where UColumn : DiGi.Core.IO.Table.Interfaces.IColumn;UColumn
The type of the column being converted, which must implement DiGi.Core.IO.Table.Interfaces.IColumn.
column UColumn
The source column instance to convert.
Column
A Column instance if the input is not null; otherwise, null.
Converts a generic table implementation to a standard Table object.
public static DiGi.PostgreSQL.Table.Classes.Table? ToDiGi<UTable,UColumn,URow>(this UTable? table)
where UTable : DiGi.Core.IO.Table.Interfaces.ITable<UColumn, URow>, new()
where UColumn : DiGi.Core.IO.Table.Interfaces.IColumn
where URow : DiGi.Core.IO.Table.Interfaces.IRow<URow>;UTable
The type of the table implementing DiGi.Core.IO.Table.Interfaces.ITable<>.
UColumn
The type of the column implementing DiGi.Core.IO.Table.Interfaces.IColumn.
URow
The type of the row implementing DiGi.Core.IO.Table.Interfaces.IRow<>.
table UTable
The source table to convert.
Table
A converted Table instance, or null if the input table is null.
public static class CreateInheritance System.Object → Create
Create.TableAsync<UColumn>(this NpgsqlConnection, string, TableConversionOptions<UColumn>, IEnumerable<UColumn>) Method
Asynchronously creates a table or adds missing columns to an existing table in the PostgreSQL database based on the provided column definitions and options.
public static System.Threading.Tasks.Task<bool> TableAsync<UColumn>(this Npgsql.NpgsqlConnection? npgsqlConnection, string tableName, DiGi.PostgreSQL.Table.Classes.TableConversionOptions<UColumn>? tableConversionOptions, System.Collections.Generic.IEnumerable<UColumn> columns)
where UColumn : DiGi.Core.IO.Table.Interfaces.IColumn;UColumn
The type of column implementation, which must implement DiGi.Core.IO.Table.Interfaces.IColumn.
npgsqlConnection Npgsql.NpgsqlConnection
The Npgsql connection instance used to execute the database commands.
tableName System.String
The name of the table to be created or modified.
tableConversionOptions DiGi.PostgreSQL.Table.Classes.TableConversionOptions<UColumn>
Optional configuration settings for table conversion, such as primary keys and partitioning rules.
columns System.Collections.Generic.IEnumerable<UColumn>
A collection of column definitions to be applied to the table.
System.Threading.Tasks.Task<System.Boolean>
A task that represents the asynchronous operation. The task result is true if the table was successfully created or updated; otherwise, false.
Initializes the metadata repository for dynamic column management. This table tracks all custom engineering parameters added to the partitioned main tables.
public static System.Threading.Tasks.Task<bool> TableAsync_Columns(this Npgsql.NpgsqlConnection? npgsqlConnection);npgsqlConnection Npgsql.NpgsqlConnection
The Npgsql connection instance used to create the columns metadata table.
System.Threading.Tasks.Task<System.Boolean>
A task that represents the asynchronous operation. The task result is true if the repository was successfully initialized; otherwise, false.
public static class ModifyInheritance System.Object → Modify
Recursively traverses a FilterGroup to collect all unique column identifiers.
public static void CollectColumnUniqueIds(this DiGi.PostgreSQL.Table.Classes.FilterGroup? filterGroup, System.Collections.Generic.HashSet<string> uniqueIds);filterGroup FilterGroup
The filter group instance to traverse.
uniqueIds System.Collections.Generic.HashSet<System.String>
The set to accumulate unique column identifiers in.
Updates or inserts column definitions into the PostgreSQL database for a specified table using an upsert operation.
public static System.Threading.Tasks.Task<bool> UpdateAsync<UColumn>(this Npgsql.NpgsqlConnection? npgsqlConnection, string tableName, System.Collections.Generic.IEnumerable<UColumn> columns)
where UColumn : DiGi.Core.IO.Table.Interfaces.IColumn;UColumn
The type of the column being updated, which must implement DiGi.Core.IO.Table.Interfaces.IColumn.
npgsqlConnection Npgsql.NpgsqlConnection
The Npgsql.NpgsqlConnection instance used to communicate with the PostgreSQL database.
tableName System.String
The name of the table whose columns are being updated.
columns System.Collections.Generic.IEnumerable<UColumn>
A collection of column objects implementing DiGi.Core.IO.Table.Interfaces.IColumn to be updated or inserted.
System.Threading.Tasks.Task<System.Boolean>
A task that represents the asynchronous operation. The task result is true if one or more rows were affected; otherwise, false.
Static partial class containing query extension methods for database operations.
public static class QueryInheritance System.Object → Query
Gets the PostgreSQL data type name for the specified column.
public static string? DataTypeName(this DiGi.Core.IO.Table.Interfaces.IColumn? column);column DiGi.Core.IO.Table.Interfaces.IColumn
The column for which to get the data type name.
System.String
The PostgreSQL data type name as a string, or null if not found.
Gets the PostgreSQL data type name for the specified .NET type.
public static string? DataTypeName(this System.Type? type);type System.Type
The .NET type for which to get the data type name.
System.String
The PostgreSQL data type name as a string, or null if not found.
Maps an DiGi.Core.IO.Table.Interfaces.IColumn to its corresponding NpgsqlTypes.NpgsqlDbType.
public static System.Nullable<NpgsqlTypes.NpgsqlDbType> NpgsqlDbType(this DiGi.Core.IO.Table.Interfaces.IColumn? column);column DiGi.Core.IO.Table.Interfaces.IColumn
The column for which the PostgreSQL data type is being determined.
System.Nullable<NpgsqlTypes.NpgsqlDbType>
The mapped NpgsqlTypes.NpgsqlDbType, or null if the mapping cannot be determined.
Maps a .NET System.Type to its corresponding NpgsqlTypes.NpgsqlDbType.
public static System.Nullable<NpgsqlTypes.NpgsqlDbType> NpgsqlDbType(this System.Type? type);type System.Type
The .NET type for which the PostgreSQL data type is being determined.
System.Nullable<NpgsqlTypes.NpgsqlDbType>
The mapped NpgsqlTypes.NpgsqlDbType, or null if the mapping cannot be determined.
Converts the provided value into a formatted partition name suffix by converting it to lowercase, trimming whitespace, and replacing spaces with underscores.
public static string? PartitionNameSuffix(object? value);value System.Object
The object value to be processed.
System.String
A formatted string representing the partition name suffix, or null if the input is not a valid string.
Query.TryBuildFilterGroupSql<UColumn>(this FilterGroup, List<UColumn>, StringBuilder, NpgsqlParameterCollection, int) Method
Recursively builds the SQL query condition and parameters from the specified FilterGroup.
public static bool TryBuildFilterGroupSql<UColumn>(this DiGi.PostgreSQL.Table.Classes.FilterGroup? filterGroup, System.Collections.Generic.List<UColumn> existingColumns, System.Text.StringBuilder stringBuilder_Sql, Npgsql.NpgsqlParameterCollection npgsqlParameterCollection, ref int parameterIndex)
where UColumn : DiGi.Core.IO.Table.Interfaces.IColumn;UColumn
The base column type deriving from DiGi.Core.IO.Table.Interfaces.IColumn.
filterGroup FilterGroup
The filter group instance to build SQL for.
existingColumns System.Collections.Generic.List<UColumn>
The list of valid whitelisted database columns.
stringBuilder_Sql System.Text.StringBuilder
The string builder to append the resulting SQL condition to.
npgsqlParameterCollection Npgsql.NpgsqlParameterCollection
The parameter collection to bind Npgsql parameters to.
parameterIndex System.Int32
A reference counter for unique query parameter names.
System.Boolean
True if the SQL condition was successfully built; otherwise, false.
Attempts to convert a given object to a value corresponding to the specified NpgsqlDbType.
public static bool TryConvert(this object? @object, out object? result, NpgsqlTypes.NpgsqlDbType npgsqlDbType);object System.Object
The source object to be converted.
result System.Object
When this method returns, contains the converted value if successful; otherwise, null.
npgsqlDbType NpgsqlTypes.NpgsqlDbType
The target PostgreSQL database type for conversion.
System.Boolean
True if the conversion was successful; otherwise, false.
Generates a unique identifier for the specified column by normalizing its name.
public static string? UniqueId(this DiGi.Core.IO.Table.Interfaces.IColumn? column);column DiGi.Core.IO.Table.Interfaces.IColumn
The column instance to process.
System.String
A normalized string representing the unique identifier, or null if the column or its name is null.