コード例 #1
0
 /// <summary>
 /// Adds a GQL parameter with the specified value.
 /// </summary>
 /// <param name="parameters">The list of positional GQL query parameters to add to. Must not be null.</param>
 /// <param name="value">The value to add.  May be null, which indicates
 /// a value with <see cref="Value.NullValue"/> set.</param>
 public static void Add(this RepeatedField <GqlQueryParameter> parameters, Value value)
 {
     GaxPreconditions.CheckNotNull(parameters, nameof(parameters));
     GaxPreconditions.CheckNotNull(value, nameof(value));
     parameters.Add(new GqlQueryParameter {
         Value = value ?? Value.ForNull()
     });
 }
コード例 #2
0
 /// <summary>
 /// Adds a GQL parameter with the specified value.
 /// </summary>
 /// <param name="parameters">The mapping of GQL query parameters to add to. Must not be null.</param>
 /// <param name="parameterName">The name of the parameter. Must not be null.</param>
 /// <param name="value">The value to add.  May be null, which indicates
 /// a value with <see cref="Value.NullValue"/> set.</param>
 public static void Add(this MapField <string, GqlQueryParameter> parameters, string parameterName, Value value)
 {
     GaxPreconditions.CheckNotNull(parameters, nameof(parameters));
     GaxPreconditions.CheckNotNull(parameterName, nameof(parameterName));
     GaxPreconditions.CheckNotNull(value, nameof(value));
     parameters.Add(parameterName, new GqlQueryParameter {
         Value = value ?? Value.ForNull()
     });
 }
コード例 #3
0
ファイル: FilterPartial.cs プロジェクト: greggaba/GCDotNet
 /// <summary>
 /// Creates a filter comparing the specified property with a given value, using a specified operator.
 /// </summary>
 /// <remarks>
 /// If the operator is known in advance, methods such as <see cref="Equal"/> and <see cref="GreaterThan"/> usually
 /// allow for better readability. This method is intended for situations where the operator is only known dynamically.
 /// </remarks>
 /// <param name="propertyName">The name of the property. Must not be null.</param>
 /// <param name="propertyValue">The value to compare against. May be null, which indicates
 /// a value with <see cref="Value.NullValue"/> set.</param>
 /// <param name="op">The comparison operator to use. Must be one of the <see cref="Operator"/> values,
 /// and not <c>Unspecified</c>.</param>
 /// <returns>The newly created filter.</returns>
 public static Filter Property(string propertyName, Value propertyValue, Operator op)
 {
     GaxPreconditions.CheckArgument(Enum.IsDefined(typeof(Operator), op) && op != Operator.Unspecified,
                                    nameof(op), "Operator must be a defined enum value and not Unspecified");
     return(new Filter
     {
         PropertyFilter = new PropertyFilter
         {
             Op = op,
             Property = new PropertyReference(propertyName),
             Value = propertyValue ?? Value.ForNull(),
         }
     });
 }
コード例 #4
0
 private static ArrayValue ToArrayValue <T>(T[] values, Func <T, Value> converter) =>
 values == null ? null : new ArrayValue
 {
     Values = { values.Select(x => converter(x) ?? Value.ForNull()) }
 };