/// <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 <BigqueryParameterType> .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="FieldMode"/>.
 /// </summary>
 internal static FieldMode GetFieldMode(this TableFieldSchema field) =>
 EnumMap <FieldMode> .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);