Class PostgreSqlObjectExtensions
- Namespace
- LfrlAnvil.PostgreSql.Extensions
- Assembly
- LfrlAnvil.PostgreSql.dll
Contains various SqlObjectBuilder and SqlObject extension methods.
public static class PostgreSqlObjectExtensions
- Inheritance
-
PostgreSqlObjectExtensions
- Inherited Members
Remarks
PostgreSqlDialect implementation.
Methods
CreateIndex(PostgreSqlConstraintBuilderCollection, params SqlOrderByNode[])
Creates a new index builder with a default name.
public static PostgreSqlIndexBuilder CreateIndex(this PostgreSqlConstraintBuilderCollection constraints, params SqlOrderByNode[] columns)
Parameters
constraints
PostgreSqlConstraintBuilderCollectionSource collection.
columns
SqlOrderByNode[]Collection of columns that define the index.
Returns
- PostgreSqlIndexBuilder
New SqlIndexBuilder instance.
Exceptions
- SqlObjectBuilderException
When index constraint could not be created.
CreateIndex(PostgreSqlConstraintBuilderCollection, string, params SqlOrderByNode[])
Creates a new index builder.
public static PostgreSqlIndexBuilder CreateIndex(this PostgreSqlConstraintBuilderCollection constraints, string name, params SqlOrderByNode[] columns)
Parameters
constraints
PostgreSqlConstraintBuilderCollectionSource collection.
name
stringName of the index constraint.
columns
SqlOrderByNode[]Collection of columns that define the index.
Returns
- PostgreSqlIndexBuilder
New SqlIndexBuilder instance.
Exceptions
- SqlObjectBuilderException
When index constraint could not be created.
CreateUniqueIndex(PostgreSqlConstraintBuilderCollection, params SqlOrderByNode[])
Creates a new unique index builder with a default name.
public static PostgreSqlIndexBuilder CreateUniqueIndex(this PostgreSqlConstraintBuilderCollection constraints, params SqlOrderByNode[] columns)
Parameters
constraints
PostgreSqlConstraintBuilderCollectionSource collection.
columns
SqlOrderByNode[]Collection of columns that define the index.
Returns
- PostgreSqlIndexBuilder
New SqlIndexBuilder instance.
Exceptions
- SqlObjectBuilderException
When index constraint could not be created.
CreateUniqueIndex(PostgreSqlConstraintBuilderCollection, string, params SqlOrderByNode[])
Creates a new unique index builder.
public static PostgreSqlIndexBuilder CreateUniqueIndex(this PostgreSqlConstraintBuilderCollection constraints, string name, params SqlOrderByNode[] columns)
Parameters
constraints
PostgreSqlConstraintBuilderCollectionSource collection.
name
stringName of the index constraint.
columns
SqlOrderByNode[]Collection of columns that define the index.
Returns
- PostgreSqlIndexBuilder
New SqlIndexBuilder instance.
Exceptions
- SqlObjectBuilderException
When index constraint could not be created.
ForPostgreSql(ISqlCheckBuilder, Action<PostgreSqlCheckBuilder>)
Invokes the provided action
only when the builder
is an instance of PostgreSqlCheckBuilder type.
public static ISqlCheckBuilder ForPostgreSql(this ISqlCheckBuilder builder, Action<PostgreSqlCheckBuilder> action)
Parameters
builder
ISqlCheckBuilderSource builder.
action
Action<PostgreSqlCheckBuilder>Action to invoke.
Returns
- ISqlCheckBuilder
builder
.
ForPostgreSql(ISqlColumnBuilder, Action<PostgreSqlColumnBuilder>)
Invokes the provided action
only when the builder
is an instance of PostgreSqlColumnBuilder type.
public static ISqlColumnBuilder ForPostgreSql(this ISqlColumnBuilder builder, Action<PostgreSqlColumnBuilder> action)
Parameters
builder
ISqlColumnBuilderSource builder.
action
Action<PostgreSqlColumnBuilder>Action to invoke.
Returns
- ISqlColumnBuilder
builder
.
ForPostgreSql(ISqlDatabaseBuilder, Action<PostgreSqlDatabaseBuilder>)
Invokes the provided action
only when the builder
is an instance of PostgreSqlDatabaseBuilder type.
public static ISqlDatabaseBuilder ForPostgreSql(this ISqlDatabaseBuilder builder, Action<PostgreSqlDatabaseBuilder> action)
Parameters
builder
ISqlDatabaseBuilderSource builder.
action
Action<PostgreSqlDatabaseBuilder>Action to invoke.
Returns
- ISqlDatabaseBuilder
builder
.
ForPostgreSql(ISqlForeignKeyBuilder, Action<PostgreSqlForeignKeyBuilder>)
Invokes the provided action
only when the builder
is an instance of PostgreSqlForeignKeyBuilder type.
public static ISqlForeignKeyBuilder ForPostgreSql(this ISqlForeignKeyBuilder builder, Action<PostgreSqlForeignKeyBuilder> action)
Parameters
builder
ISqlForeignKeyBuilderSource builder.
action
Action<PostgreSqlForeignKeyBuilder>Action to invoke.
Returns
- ISqlForeignKeyBuilder
builder
.
ForPostgreSql(ISqlIndexBuilder, Action<PostgreSqlIndexBuilder>)
Invokes the provided action
only when the builder
is an instance of PostgreSqlIndexBuilder type.
public static ISqlIndexBuilder ForPostgreSql(this ISqlIndexBuilder builder, Action<PostgreSqlIndexBuilder> action)
Parameters
builder
ISqlIndexBuilderSource builder.
action
Action<PostgreSqlIndexBuilder>Action to invoke.
Returns
- ISqlIndexBuilder
builder
.
ForPostgreSql(ISqlPrimaryKeyBuilder, Action<PostgreSqlPrimaryKeyBuilder>)
Invokes the provided action
only when the builder
is an instance of PostgreSqlPrimaryKeyBuilder type.
public static ISqlPrimaryKeyBuilder ForPostgreSql(this ISqlPrimaryKeyBuilder builder, Action<PostgreSqlPrimaryKeyBuilder> action)
Parameters
builder
ISqlPrimaryKeyBuilderSource builder.
action
Action<PostgreSqlPrimaryKeyBuilder>Action to invoke.
Returns
- ISqlPrimaryKeyBuilder
builder
.
ForPostgreSql(ISqlSchemaBuilder, Action<PostgreSqlSchemaBuilder>)
Invokes the provided action
only when the builder
is an instance of PostgreSqlSchemaBuilder type.
public static ISqlSchemaBuilder ForPostgreSql(this ISqlSchemaBuilder builder, Action<PostgreSqlSchemaBuilder> action)
Parameters
builder
ISqlSchemaBuilderSource builder.
action
Action<PostgreSqlSchemaBuilder>Action to invoke.
Returns
- ISqlSchemaBuilder
builder
.
ForPostgreSql(ISqlTableBuilder, Action<PostgreSqlTableBuilder>)
Invokes the provided action
only when the builder
is an instance of PostgreSqlTableBuilder type.
public static ISqlTableBuilder ForPostgreSql(this ISqlTableBuilder builder, Action<PostgreSqlTableBuilder> action)
Parameters
builder
ISqlTableBuilderSource builder.
action
Action<PostgreSqlTableBuilder>Action to invoke.
Returns
- ISqlTableBuilder
builder
.
ForPostgreSql(ISqlViewBuilder, Action<PostgreSqlViewBuilder>)
Invokes the provided action
only when the builder
is an instance of PostgreSqlViewBuilder type.
public static ISqlViewBuilder ForPostgreSql(this ISqlViewBuilder builder, Action<PostgreSqlViewBuilder> action)
Parameters
builder
ISqlViewBuilderSource builder.
action
Action<PostgreSqlViewBuilder>Action to invoke.
Returns
- ISqlViewBuilder
builder
.
SetDefaultValue<T>(PostgreSqlColumnBuilder, T?)
Changes DefaultValue value of the provided column
.
public static PostgreSqlColumnBuilder SetDefaultValue<T>(this PostgreSqlColumnBuilder column, T? value) where T : struct
Parameters
column
PostgreSqlColumnBuilderSource column.
value
T?Value to set.
Returns
- PostgreSqlColumnBuilder
column
.
Type Parameters
T
Value type.
Exceptions
- SqlObjectBuilderException
When default value cannot be changed.
SetDefaultValue<T>(PostgreSqlColumnBuilder, T?)
Changes DefaultValue value of the provided column
.
public static PostgreSqlColumnBuilder SetDefaultValue<T>(this PostgreSqlColumnBuilder column, T? value) where T : notnull
Parameters
column
PostgreSqlColumnBuilderSource column.
value
TValue to set.
Returns
- PostgreSqlColumnBuilder
column
.
Type Parameters
T
Value type.
Exceptions
- SqlObjectBuilderException
When default value cannot be changed.
SetFilter(PostgreSqlIndexBuilder, Func<SqlTableBuilderNode, SqlConditionNode?>)
Changes Filter value of the provided index
.
public static PostgreSqlIndexBuilder SetFilter(this PostgreSqlIndexBuilder index, Func<SqlTableBuilderNode, SqlConditionNode?> filter)
Parameters
index
PostgreSqlIndexBuilderSource index.
filter
Func<SqlTableBuilderNode, SqlConditionNode>Value to set.
Returns
- PostgreSqlIndexBuilder
index
.
Exceptions
- SqlObjectBuilderException
When filter cannot be changed.
SetPrimaryKey(PostgreSqlConstraintBuilderCollection, params SqlOrderByNode[])
Creates a new unique index builder with a default name and sets a new primary key builder with a default name based on that index.
public static PostgreSqlPrimaryKeyBuilder SetPrimaryKey(this PostgreSqlConstraintBuilderCollection constraints, params SqlOrderByNode[] columns)
Parameters
constraints
PostgreSqlConstraintBuilderCollectionSource collection.
columns
SqlOrderByNode[]Collection of columns that define the underlying index.
Returns
- PostgreSqlPrimaryKeyBuilder
New SqlPrimaryKeyBuilder instance.
Exceptions
- SqlObjectBuilderException
When unique index constraint or primary key constraint could not be created.
SetPrimaryKey(PostgreSqlConstraintBuilderCollection, string, params SqlOrderByNode[])
Creates a new unique index builder with a default name and sets a new primary key builder based on that index.
public static PostgreSqlPrimaryKeyBuilder SetPrimaryKey(this PostgreSqlConstraintBuilderCollection constraints, string name, params SqlOrderByNode[] columns)
Parameters
constraints
PostgreSqlConstraintBuilderCollectionSource collection.
name
stringName of the primary key constraint.
columns
SqlOrderByNode[]Collection of columns that define the underlying index.
Returns
- PostgreSqlPrimaryKeyBuilder
New SqlPrimaryKeyBuilder instance.
Exceptions
- SqlObjectBuilderException
When unique index constraint or primary key constraint could not be created.
SetType(PostgreSqlColumnBuilder, PostgreSqlDataType)
Changes TypeDefinition value of the provided column
.
public static PostgreSqlColumnBuilder SetType(this PostgreSqlColumnBuilder column, PostgreSqlDataType dataType)
Parameters
column
PostgreSqlColumnBuilderSource column.
dataType
PostgreSqlDataTypePostgreSqlDataType to use for retrieving a default type definition associated with it.
Returns
- PostgreSqlColumnBuilder
column
.
Remarks
Changing the type will reset the DefaultValue to null.
Exceptions
- SqlObjectBuilderException
When type definition cannot be changed.
SetType(PostgreSqlColumnBuilder, Type)
Changes TypeDefinition value of the provided column
.
public static PostgreSqlColumnBuilder SetType(this PostgreSqlColumnBuilder column, Type type)
Parameters
column
PostgreSqlColumnBuilderSource column.
type
TypeRuntime type to use for retrieving a type definition associated with it.
Returns
- PostgreSqlColumnBuilder
column
.
Remarks
Changing the type will reset the DefaultValue to null.
Exceptions
- SqlObjectBuilderException
When type definition cannot be changed.
SetType<T>(PostgreSqlColumnBuilder)
Changes TypeDefinition value of the provided column
.
public static PostgreSqlColumnBuilder SetType<T>(this PostgreSqlColumnBuilder column)
Parameters
column
PostgreSqlColumnBuilderSource column.
Returns
- PostgreSqlColumnBuilder
column
.
Type Parameters
T
Runtime type to use for retrieving a type definition associated with it.
Remarks
Changing the type will reset the DefaultValue to null.
Exceptions
- SqlObjectBuilderException
When type definition cannot be changed.