Google Cloud Datastore v1 API - Class Filter (4.3.0)

Stay organized with collections Save and categorize content based on your preferences.
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
NameDescription
otherFilter

Properties

CompositeFilter

public CompositeFilter CompositeFilter { get; set; }

A composite filter.

Property Value
TypeDescription
CompositeFilter

FilterTypeCase

public Filter.FilterTypeOneofCase FilterTypeCase { get; }
Property Value
TypeDescription
Filter.FilterTypeOneofCase

PropertyFilter

public PropertyFilter PropertyFilter { get; set; }

A filter on a property.

Property Value
TypeDescription
PropertyFilter

Methods

And(Filter[])

public static Filter And(params Filter[] filters)

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

Parameter
NameDescription
filtersFilter[]

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

Returns
TypeDescription
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
NameDescription
filtersIEnumerable<Filter>

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

Returns
TypeDescription
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
NameDescription
propertyNameString

The name of the property. Must not be null.

propertyValueValue

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

Returns
TypeDescription
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
NameDescription
propertyNameString

The name of the property. Must not be null.

propertyValueValue

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

Returns
TypeDescription
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
NameDescription
propertyNameString

The name of the property. Must not be null.

propertyValueValue

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

Returns
TypeDescription
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
NameDescription
ancestorKeyKey

The key to check against. Must not be null.

Returns
TypeDescription
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
NameDescription
valueString

The name of the property. Must not be null.

collectionArrayValue

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

Returns
TypeDescription
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
NameDescription
propertyNameString

The name of the property. Must not be null.

propertyValueValue

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

Returns
TypeDescription
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
NameDescription
propertyNameString

The name of the property. Must not be null.

propertyValueValue

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

Returns
TypeDescription
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
NameDescription
propertyNameString

The name of the property. Must not be null.

propertyValueValue

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

Returns
TypeDescription
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
NameDescription
valueString

The name of the property. Must not be null.

collectionArrayValue

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

Returns
TypeDescription
Filter

The newly created filter.

Property(String, Value, PropertyFilter.Types.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
NameDescription
propertyNameString

The name of the property. Must not be null.

propertyValueValue

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

opPropertyFilter.Types.Operator

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

Returns
TypeDescription
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.