Class PgFunctionExpression
- Assembly
- Npgsql.EntityFrameworkCore.PostgreSQL.dll
Represents a SQL function call expression, supporting PostgreSQL's named parameter notation (e.g. make_interval(weeks => 2) and non-comma parameter separators (e.g. position(substring in string)).
public class PgFunctionExpression : SqlFunctionExpression, IRelationalQuotableExpression, IPrintableExpression, IEquatable<PgFunctionExpression>
- Inheritance
-
PgFunctionExpression
- Implements
- Inherited Members
Constructors
PgFunctionExpression(string, IEnumerable<SqlExpression>, IEnumerable<string?>?, IEnumerable<string?>?, bool, SqlExpression?, IReadOnlyList<OrderingExpression>, bool, IEnumerable<bool>, Type, RelationalTypeMapping?)
Creates a new instance of PgFunctionExpression.
public PgFunctionExpression(string name, IEnumerable<SqlExpression> arguments, IEnumerable<string?>? argumentNames, IEnumerable<string?>? argumentSeparators, bool aggregateDistinct, SqlExpression? aggregatePredicate, IReadOnlyList<OrderingExpression> aggregateOrderings, bool nullable, IEnumerable<bool> argumentsPropagateNullability, Type type, RelationalTypeMapping? typeMapping)
Parameters
name
stringarguments
IEnumerable<SqlExpression>argumentNames
IEnumerable<string>argumentSeparators
IEnumerable<string>aggregateDistinct
boolaggregatePredicate
SqlExpressionaggregateOrderings
IReadOnlyList<OrderingExpression>nullable
boolargumentsPropagateNullability
IEnumerable<bool>type
TypetypeMapping
RelationalTypeMapping
Properties
AggregateOrderings
For aggregate methods, contains the orderings to be applied.
public virtual IReadOnlyList<OrderingExpression> AggregateOrderings { get; }
Property Value
AggregatePredicate
For aggregate methods, contains the predicate to be applied (generated as the SQL FILTER clause).
public virtual SqlExpression? AggregatePredicate { get; }
Property Value
ArgumentNames
List of argument names, corresponding position-wise to arguments in Arguments. Unnamed (positional) arguments must come first, so this list must contain possible nulls, followed by non-nulls.
public virtual IReadOnlyList<string?> ArgumentNames { get; }
Property Value
ArgumentSeparators
List of non-comma separators between argument separators, in the order in which they appear between
the arguments. null
as well as positions beyond the end of the list mean regular commas.
public virtual IReadOnlyList<string?> ArgumentSeparators { get; }
Property Value
Arguments
public virtual IReadOnlyList<SqlExpression> Arguments { get; }
Property Value
ArgumentsPropagateNullability
public virtual IReadOnlyList<bool> ArgumentsPropagateNullability { get; }
Property Value
IsAggregateDistinct
For aggregate methods, contains whether to apply distinct.
public virtual bool IsAggregateDistinct { get; }
Property Value
Methods
ApplyTypeMapping(RelationalTypeMapping?)
Applies supplied type mapping to this expression.
public override SqlFunctionExpression ApplyTypeMapping(RelationalTypeMapping? typeMapping)
Parameters
typeMapping
RelationalTypeMappingA relational type mapping to apply.
Returns
- SqlFunctionExpression
A new expression which has supplied type mapping.
CreateWithArgumentSeparators(string, IEnumerable<SqlExpression>, IEnumerable<string?>, bool, IEnumerable<bool>, bool, Type, RelationalTypeMapping?)
Creates an instance of PgFunctionExpression with argument separators.
public static PgFunctionExpression CreateWithArgumentSeparators(string name, IEnumerable<SqlExpression> arguments, IEnumerable<string?> argumentSeparators, bool nullable, IEnumerable<bool> argumentsPropagateNullability, bool builtIn, Type type, RelationalTypeMapping? typeMapping)
Parameters
name
stringarguments
IEnumerable<SqlExpression>argumentSeparators
IEnumerable<string>nullable
boolargumentsPropagateNullability
IEnumerable<bool>builtIn
booltype
TypetypeMapping
RelationalTypeMapping
Returns
CreateWithNamedArguments(string, IEnumerable<SqlExpression>, IEnumerable<string?>, bool, IEnumerable<bool>, bool, Type, RelationalTypeMapping?)
Creates an instance of PgFunctionExpression with named arguments.
public static PgFunctionExpression CreateWithNamedArguments(string name, IEnumerable<SqlExpression> arguments, IEnumerable<string?> argumentNames, bool nullable, IEnumerable<bool> argumentsPropagateNullability, bool builtIn, Type type, RelationalTypeMapping? typeMapping)
Parameters
name
stringarguments
IEnumerable<SqlExpression>argumentNames
IEnumerable<string>nullable
boolargumentsPropagateNullability
IEnumerable<bool>builtIn
booltype
TypetypeMapping
RelationalTypeMapping
Returns
Equals(PgFunctionExpression?)
Indicates whether the current object is equal to another object of the same type.
public virtual bool Equals(PgFunctionExpression? other)
Parameters
other
PgFunctionExpressionAn object to compare with this object.
Returns
Equals(object?)
Determines whether the specified object is equal to the current object.
public override bool Equals(object? obj)
Parameters
obj
objectThe object to compare with the current object.
Returns
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
Print(ExpressionPrinter)
Creates a printable string representation of the given expression using ExpressionPrinter.
protected override void Print(ExpressionPrinter expressionPrinter)
Parameters
expressionPrinter
ExpressionPrinterThe expression printer to use.
Update(SqlExpression?, IReadOnlyList<SqlExpression>?)
Creates a new expression that is like this one, but using the supplied children. If all of the children are the same, it will return this expression.
public override SqlFunctionExpression Update(SqlExpression? instance, IReadOnlyList<SqlExpression>? arguments)
Parameters
instance
SqlExpressionThe Instance property of the result.
arguments
IReadOnlyList<SqlExpression>The Arguments property of the result.
Returns
- SqlFunctionExpression
This expression if no children changed, or an expression with the updated children.
UpdateAggregateComponents(SqlExpression?, IReadOnlyList<OrderingExpression>)
Creates a new expression that is like this one, but using the supplied children. If all of the children are the same, it will return this expression.
public virtual PgFunctionExpression UpdateAggregateComponents(SqlExpression? predicate, IReadOnlyList<OrderingExpression> orderings)
Parameters
predicate
SqlExpressionorderings
IReadOnlyList<OrderingExpression>
Returns
VisitChildren(ExpressionVisitor)
Reduces the node and then calls the visitor delegate on the reduced expression. The method throws an exception if the node is not reducible.
protected override Expression VisitChildren(ExpressionVisitor visitor)
Parameters
visitor
ExpressionVisitorAn instance of Func<T, TResult>.
Returns
- Expression
The expression being visited, or an expression which should replace it in the tree.