Skip to content

DiGi.PostgreSQL.Table

github-actions[bot] edited this page Jul 15, 2026 · 2 revisions

DiGi.PostgreSQL.Table Namespace

Classes

Convert Class

public static class Convert

Inheritance System.Object → Convert

Methods

Convert.ToDiGi<UColumn>(this UColumn) Method

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;

Type parameters

UColumn

The type of the column being converted, which must implement DiGi.Core.IO.Table.Interfaces.IColumn.

Parameters

column UColumn

The source column instance to convert.

Returns

Column
A Column instance if the input is not null; otherwise, null.

Convert.ToDiGi<UTable,UColumn,URow>(this UTable) Method

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>;

Type parameters

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<>.

Parameters

table UTable

The source table to convert.

Returns

Table
A converted Table instance, or null if the input table is null.

Create Class

public static class Create

Inheritance System.Object → Create

Methods

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;

Type parameters

UColumn

The type of column implementation, which must implement DiGi.Core.IO.Table.Interfaces.IColumn.

Parameters

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.

Returns

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.

Create.TableAsync_Columns(this NpgsqlConnection) Method

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);

Parameters

npgsqlConnection Npgsql.NpgsqlConnection

The Npgsql connection instance used to create the columns metadata table.

Returns

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.

Modify Class

public static class Modify

Inheritance System.Object → Modify

Methods

Modify.CollectColumnUniqueIds(this FilterGroup, HashSet<string>) Method

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);

Parameters

filterGroup FilterGroup

The filter group instance to traverse.

uniqueIds System.Collections.Generic.HashSet<System.String>

The set to accumulate unique column identifiers in.

Modify.UpdateAsync<UColumn>(this NpgsqlConnection, string, IEnumerable<UColumn>) Method

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;

Type parameters

UColumn

The type of the column being updated, which must implement DiGi.Core.IO.Table.Interfaces.IColumn.

Parameters

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.

Returns

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.

Query Class

Static partial class containing query extension methods for database operations.

public static class Query

Inheritance System.Object → Query

Methods

Query.DataTypeName(this IColumn) Method

Gets the PostgreSQL data type name for the specified column.

public static string? DataTypeName(this DiGi.Core.IO.Table.Interfaces.IColumn? column);

Parameters

column DiGi.Core.IO.Table.Interfaces.IColumn

The column for which to get the data type name.

Returns

System.String
The PostgreSQL data type name as a string, or null if not found.

Query.DataTypeName(this Type) Method

Gets the PostgreSQL data type name for the specified .NET type.

public static string? DataTypeName(this System.Type? type);

Parameters

type System.Type

The .NET type for which to get the data type name.

Returns

System.String
The PostgreSQL data type name as a string, or null if not found.

Query.NpgsqlDbType(this IColumn) Method

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);

Parameters

column DiGi.Core.IO.Table.Interfaces.IColumn

The column for which the PostgreSQL data type is being determined.

Returns

System.Nullable<NpgsqlTypes.NpgsqlDbType>
The mapped NpgsqlTypes.NpgsqlDbType, or null if the mapping cannot be determined.

Query.NpgsqlDbType(this Type) Method

Maps a .NET System.Type to its corresponding NpgsqlTypes.NpgsqlDbType.

public static System.Nullable<NpgsqlTypes.NpgsqlDbType> NpgsqlDbType(this System.Type? type);

Parameters

type System.Type

The .NET type for which the PostgreSQL data type is being determined.

Returns

System.Nullable<NpgsqlTypes.NpgsqlDbType>
The mapped NpgsqlTypes.NpgsqlDbType, or null if the mapping cannot be determined.

Query.PartitionNameSuffix(object) Method

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);

Parameters

value System.Object

The object value to be processed.

Returns

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;

Type parameters

UColumn

The base column type deriving from DiGi.Core.IO.Table.Interfaces.IColumn.

Parameters

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.

Returns

System.Boolean
True if the SQL condition was successfully built; otherwise, false.

Query.TryConvert(this object, object, NpgsqlDbType) Method

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);

Parameters

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.

Returns

System.Boolean
True if the conversion was successful; otherwise, false.

Query.UniqueId(this IColumn) Method

Generates a unique identifier for the specified column by normalizing its name.

public static string? UniqueId(this DiGi.Core.IO.Table.Interfaces.IColumn? column);

Parameters

column DiGi.Core.IO.Table.Interfaces.IColumn

The column instance to process.

Returns

System.String
A normalized string representing the unique identifier, or null if the column or its name is null.

Clone this wiki locally