Table of Contents

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 = 1

Equality comparison (=). Tests if values are exactly equal.

NotEquals = 2

Inequality comparison (!= or <>). Tests if values are not equal.

LessThan = 3

Less than comparison (<). Tests if left value is less than right value.

GreaterThan = 4

Greater than comparison (>). Tests if left value is greater than right value.

LessThanOrEqualTo = 5

Less than or equal comparison (<=). Tests if left value is less than or equal to right value.

GreaterThanOrEqualTo = 6

Greater than or equal comparison (>=). Tests if left value is greater than or equal to right value.

Like = 7

Pattern matching using wildcards. Tests if text matches a pattern with % (any characters) and _ (single character) wildcards.

Between = 8

Range comparison. Tests if value falls within an inclusive range between two values.

In = 9

Set membership test. Tests if value matches any value in a specified list.

NotIn = 10

Negative set membership test. Tests if value does not match any value in a specified list.

IsNull = 11

NULL check. Tests if value is NULL.

IsNotNull = 12

NOT NULL check. Tests if value is not NULL.

Remarks

Conditional types are used with Criterion objects to filter query results. They map to standard SQL comparison operators and predicates.

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