/// <summary> /// If the value is null, populate the parameter with an QueryParameterValue. Otherwise, /// throw an exception - this is expected to be the last call in a chain, so at this point we know /// we can't handle a value of this type. /// </summary> internal static QueryParameter UseNullScalarOrThrow(this QueryParameter parameter, object value) { if (value == null) { parameter.ParameterValue = new QueryParameterValue(); return parameter; } var clrEnum = EnumMap<BigQueryDbType>.ToValue(parameter.ParameterType.Type); throw new InvalidOperationException($"Value of type {value.GetType()} cannot be used for a parameter of type {clrEnum}"); }
/// <summary> /// Returns the mode of a field as a <see cref="BigQueryFieldMode"/>. /// If the mode isn't specified, it defaults to Nullable. /// </summary> internal static BigQueryFieldMode GetFieldMode(this TableFieldSchema field) => field.Mode == null ? BigQueryFieldMode.Nullable : EnumMap <BigQueryFieldMode> .ToValue(field.Mode);
/// <summary> /// Returns the type of a field as a <see cref="BigQueryDbType"/>. /// </summary> internal static BigQueryDbType GetFieldType(this TableFieldSchema field) => EnumMap <BigQueryDbType> .ToValue(field.Type);
/// <summary> /// Returns the mode of a field as a <see cref="BigQueryFieldMode"/>. /// </summary> internal static BigQueryFieldMode GetFieldMode(this TableFieldSchema field) => EnumMap <BigQueryFieldMode> .ToValue(field.Mode);