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
constraintsPostgreSqlConstraintBuilderCollectionSource collection.
columnsSqlOrderByNode[]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
constraintsPostgreSqlConstraintBuilderCollectionSource collection.
namestringName of the index constraint.
columnsSqlOrderByNode[]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
constraintsPostgreSqlConstraintBuilderCollectionSource collection.
columnsSqlOrderByNode[]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
constraintsPostgreSqlConstraintBuilderCollectionSource collection.
namestringName of the index constraint.
columnsSqlOrderByNode[]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
builderISqlCheckBuilderSource builder.
actionAction<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
builderISqlColumnBuilderSource builder.
actionAction<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
builderISqlDatabaseBuilderSource builder.
actionAction<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
builderISqlForeignKeyBuilderSource builder.
actionAction<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
builderISqlIndexBuilderSource builder.
actionAction<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
builderISqlPrimaryKeyBuilderSource builder.
actionAction<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
builderISqlSchemaBuilderSource builder.
actionAction<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
builderISqlTableBuilderSource builder.
actionAction<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
builderISqlViewBuilderSource builder.
actionAction<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
columnPostgreSqlColumnBuilderSource column.
valueT?Value to set.
Returns
- PostgreSqlColumnBuilder
column.
Type Parameters
TValue 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
columnPostgreSqlColumnBuilderSource column.
valueTValue to set.
Returns
- PostgreSqlColumnBuilder
column.
Type Parameters
TValue 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
indexPostgreSqlIndexBuilderSource index.
filterFunc<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
constraintsPostgreSqlConstraintBuilderCollectionSource collection.
columnsSqlOrderByNode[]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
constraintsPostgreSqlConstraintBuilderCollectionSource collection.
namestringName of the primary key constraint.
columnsSqlOrderByNode[]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
columnPostgreSqlColumnBuilderSource column.
dataTypePostgreSqlDataTypePostgreSqlDataType 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
columnPostgreSqlColumnBuilderSource column.
typeTypeRuntime 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
columnPostgreSqlColumnBuilderSource column.
Returns
- PostgreSqlColumnBuilder
column.
Type Parameters
TRuntime 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.