Enum ConditionalType
- Namespace
- YndigoBlue.Velocity.Enums
- Assembly
- YndigoBlue.Velocity.dll
Specifies the comparison operator used in WHERE clause conditions and query filters.
public enum ConditionalType
Fields
Equals = 1Equality comparison (=). Tests if values are exactly equal.
NotEquals = 2Inequality comparison (!= or <>). Tests if values are not equal.
LessThan = 3Less than comparison (<). Tests if left value is less than right value.
GreaterThan = 4Greater than comparison (>). Tests if left value is greater than right value.
LessThanOrEqualTo = 5Less than or equal comparison (<=). Tests if left value is less than or equal to right value.
GreaterThanOrEqualTo = 6Greater than or equal comparison (>=). Tests if left value is greater than or equal to right value.
Like = 7Pattern matching using wildcards. Tests if text matches a pattern with % (any characters) and _ (single character) wildcards.
Between = 8Range comparison. Tests if value falls within an inclusive range between two values.
In = 9Set membership test. Tests if value matches any value in a specified list.
NotIn = 10Negative set membership test. Tests if value does not match any value in a specified list.
IsNull = 11NULL check. Tests if value is NULL.
IsNotNull = 12NOT NULL check. Tests if value is not NULL.
Examples
var conn = new PostgreSqlDatasourceConnection
{
Hostname = "localhost",
Database = "mydatabase",
Username = "user",
Password = "password"
};
using (var manager = new Manager(conn))
{
var schema = manager.LoadSchema("public");
var productsTable = schema["products"];
// Using different conditional types in queries
var query1 = new Query()
.Select([productsTable["id"], productsTable["name"], productsTable["price"]])
.From(productsTable)
.Where(new Criterion<decimal>(productsTable["price"], ConditionalType.GreaterThan, 100));
var query2 = new Query()
.Select([productsTable["id"], productsTable["name"]])
.From(productsTable)
.Where(new Criterion<string>(productsTable["name"], ConditionalType.Like, "%Widget%"));
var query3 = new Query()
.Select([productsTable["id"], productsTable["description"]])
.From(productsTable)
.Where(new Criterion<string>(productsTable["description"], ConditionalType.IsNotNull));
}
Remarks
Conditional types are used with Criterion objects to filter query results. They map to standard SQL comparison operators and predicates.