docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class QueryFilter

    A filter for an individual field that is applied to a query.

    Inheritance
    object
    QueryFilter
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Unity.Services.Lobbies.Models
    Assembly: Unity.Services.Multiplayer.dll
    Syntax
    [Preserve]
    [DataContract(Name = "QueryFilter")]
    public class QueryFilter

    Constructors

    QueryFilter(FieldOptions, string, OpOptions)

    A filter for an individual field that is applied to a query.

    Declaration
    [Preserve]
    public QueryFilter(QueryFilter.FieldOptions field, string value, QueryFilter.OpOptions op)
    Parameters
    Type Name Description
    QueryFilter.FieldOptions field

    The name of the field to filter on. For custom data fields, the name of the index must be used instead of the field name.

    string value

    The value to compare to the field being filtered. This value must be a string and it must be parsable as the same type as field (e.g. integer for MaxPlayers, datetime for Created, etc.). The value for datetime fields (Created, LastUpdated) must be in RFC3339 format. For example, in C# this can be achieved using the "o" format specifier: return dateTime.ToString(\"o\", DateTimeFormatInfo.InvariantInfo);. Refer to your language documentation for other methods to generate RFC3339-compatible datetime strings.

    QueryFilter.OpOptions op

    The operator used to compare the field to the filter value. Supports CONTAINS (only on the Name field), EQ (Equal), NE (Not Equal), LT (Less Than), LE (Less Than or Equal), GT (Greater Than), and GE (Greater Than or Equal).

    Properties

    Field

    The name of the field to filter on. For custom data fields, the name of the index must be used instead of the field name.

    Declaration
    [Preserve]
    [JsonConverter(typeof(StringEnumConverter))]
    [DataMember(Name = "field", IsRequired = true, EmitDefaultValue = true)]
    public QueryFilter.FieldOptions Field { get; }
    Property Value
    Type Description
    QueryFilter.FieldOptions

    Op

    The operator used to compare the field to the filter value. Supports CONTAINS (only on the Name field), EQ (Equal), NE (Not Equal), LT (Less Than), LE (Less Than or Equal), GT (Greater Than), and GE (Greater Than or Equal).

    Declaration
    [Preserve]
    [JsonConverter(typeof(StringEnumConverter))]
    [DataMember(Name = "op", IsRequired = true, EmitDefaultValue = true)]
    public QueryFilter.OpOptions Op { get; }
    Property Value
    Type Description
    QueryFilter.OpOptions

    Value

    The value to compare to the field being filtered. This value must be a string and it must be parsable as the same type as field (e.g. integer for MaxPlayers, datetime for Created, etc.). The value for datetime fields (Created, LastUpdated) must be in RFC3339 format. For example, in C# this can be achieved using the "o" format specifier: return dateTime.ToString(\"o\", DateTimeFormatInfo.InvariantInfo);. Refer to your language documentation for other methods to generate RFC3339-compatible datetime strings.

    Declaration
    [Preserve]
    [DataMember(Name = "value", IsRequired = true, EmitDefaultValue = true)]
    public string Value { get; }
    Property Value
    Type Description
    string
    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)