Google Cloud Datastore v1 API - Class Filter (4.10.0)

public sealed class Filter : IMessage<Filter>, IEquatable<Filter>, IDeepCloneable<Filter>, IBufferMessage, IMessage

Reference documentation and code samples for the Google Cloud Datastore v1 API class Filter.

A holder for any type of filter.

Inheritance

object > Filter

Namespace

Google.Cloud.Datastore.V1

Assembly

Google.Cloud.Datastore.V1.dll

Constructors

Filter()

public Filter()

Filter(Filter)

public Filter(Filter other)
Parameter
Name Description
other Filter

Properties

CompositeFilter

public CompositeFilter CompositeFilter { get; set; }

A composite filter.

Property Value
Type Description
CompositeFilter

FilterTypeCase

public Filter.FilterTypeOneofCase FilterTypeCase { get; }
Property Value
Type Description
FilterFilterTypeOneofCase

PropertyFilter

public PropertyFilter PropertyFilter { get; set; }

A filter on a property.

Property Value
Type Description
PropertyFilter

Methods

And(params Filter[])

public static Filter And(params Filter[] filters)

Creates a composite filter which is the logical "AND" of all the specified filters.

Parameter
Name Description
filters Filter

Set of filters to combine. Must not be null or empty, or contain null references.

Returns
Type Description
Filter

A filter representing the logical "AND" of all the elements in filters.

And(IEnumerable<Filter>)

public static Filter And(IEnumerable<Filter> filters)

Creates a composite filter which is the logical "AND" of all the specified filters.

Parameter
Name Description
filters IEnumerableFilter

Set of filters to combine. Must not be null or empty, or contain null references.

Returns
Type Description
Filter

A filter representing the logical "AND" of all the elements in filters.

Equal(string, Value)

public static Filter Equal(string propertyName, Value propertyValue)

Creates a filter to check that the specified property is equal to a given value.

Parameters
Name Description
propertyName string

The name of the property. Must not be null.

propertyValue Value

The value to compare against. May be null, which indicates a value with NullValue set.

Returns
Type Description
Filter

The newly created filter.

GreaterThan(string, Value)

public static Filter GreaterThan(string propertyName, Value propertyValue)

Creates a filter to check that the specified property is greater than a given value.

Parameters
Name Description
propertyName string

The name of the property. Must not be null.

propertyValue Value

The value to compare against. May be null, which indicates a value with NullValue set.

Returns
Type Description
Filter

The newly created filter.

GreaterThanOrEqual(string, Value)

public static Filter GreaterThanOrEqual(string propertyName, Value propertyValue)

Creates a filter to check that the specified property is greater than or equal to a given value.

Parameters
Name Description
propertyName string

The name of the property. Must not be null.

propertyValue Value

The value to compare against. May be null, which indicates a value with NullValue set.

Returns
Type Description
Filter

The newly created filter.

HasAncestor(Key)

public static Filter HasAncestor(Key ancestorKey)

Creates a filter to check that an entity has the specified key as an ancestor.

Parameter
Name Description
ancestorKey Key

The key to check against. Must not be null.

Returns
Type Description
Filter

The newly created filter.

In(string, ArrayValue)

public static Filter In(string value, ArrayValue collection)

Creates a filter to check that the specified property is in a given array of values.

Parameters
Name Description
value string

The name of the property. Must not be null.

collection ArrayValue

The array of values to compare against. Must not be null.

Returns
Type Description
Filter

The newly created filter.

LessThan(string, Value)

public static Filter LessThan(string propertyName, Value propertyValue)

Creates a filter to check that the specified property is less than a given value.

Parameters
Name Description
propertyName string

The name of the property. Must not be null.

propertyValue Value

The value to compare against. May be null, which indicates a value with NullValue set.

Returns
Type Description
Filter

The newly created filter.

LessThanOrEqual(string, Value)

public static Filter LessThanOrEqual(string propertyName, Value propertyValue)

Creates a filter to check that the specified property is less than or equal to a given value.

Parameters
Name Description
propertyName string

The name of the property. Must not be null.

propertyValue Value

The value to compare against. May be null, which indicates a value with NullValue set.

Returns
Type Description
Filter

The newly created filter.

NotEqual(string, Value)

public static Filter NotEqual(string propertyName, Value propertyValue)

Creates a filter to check that the specified property is not equal to a given value.

Parameters
Name Description
propertyName string

The name of the property. Must not be null.

propertyValue Value

The value to compare against. May be null, which indicates a value with NullValue set.

Returns
Type Description
Filter

The newly created filter.

NotIn(string, ArrayValue)

public static Filter NotIn(string value, ArrayValue collection)

Creates a filter to check that the specified property is not in a given array of values.

Parameters
Name Description
value string

The name of the property. Must not be null.

collection ArrayValue

The array of values to compare against. Must not be null.

Returns
Type Description
Filter

The newly created filter.

Or(params Filter[])

public static Filter Or(params Filter[] filters)

Creates a composite filter which is the logical "OR" of all the specified filters.

Parameter
Name Description
filters Filter

Set of filters to combine. Must not be null or empty, or contain null references.

Returns
Type Description
Filter

A filter representing the logical "OR" of all the elements in filters.

Or(IEnumerable<Filter>)

public static Filter Or(IEnumerable<Filter> filters)

Creates a composite filter which is the logical "OR" of all the specified filters.

Parameter
Name Description
filters IEnumerableFilter

Set of filters to combine. Must not be null or empty, or contain null references.

Returns
Type Description
Filter

A filter representing the logical "OR" of all the elements in filters.

Property(string, Value, Operator)

public static Filter Property(string propertyName, Value propertyValue, PropertyFilter.Types.Operator op)

Creates a filter comparing the specified property with a given value, using a specified operator.

Parameters
Name Description
propertyName string

The name of the property. Must not be null.

propertyValue Value

The value to compare against. May be null, which indicates a value with NullValue set.

op PropertyFilterTypesOperator

The comparison operator to use. Must be one of the PropertyFilter.Types.Operator values, and not Unspecified.

Returns
Type Description
Filter

The newly created filter.

Remarks

If the operator is known in advance, methods such as Equal(string, Value) and GreaterThan(string, Value) usually allow for better readability. This method is intended for situations where the operator is only known dynamically.