#877 fix: Detect Geography type during parameterized query

Merged Steffany Brown steffnay

No flags found

Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.

e.g., #unittest #integration

#production #enterprise

#frontend #backend

Learn more about Codecov Flags here.

Showing 1 of 2 files from the diff.
Other files ignored by Codecov
test/bigquery.ts has changed.

@@ -890,6 +890,8 @@
Loading
890 890
      typeName = 'BYTES';
891 891
    } else if (value instanceof Big) {
892 892
      typeName = 'NUMERIC';
893 +
    } else if (value instanceof Geography) {
894 +
      typeName = 'GEOGRAPHY';
893 895
    } else if (Array.isArray(value)) {
894 896
      if (value.length === 0) {
895 897
        throw new Error(
@@ -964,7 +966,7 @@
Loading
964 966
    if (typeName === 'ARRAY') {
965 967
      queryParameter.parameterValue!.arrayValues = (value as Array<{}>).map(
966 968
        itemValue => {
967 -
          const value = getValue(itemValue, parameterType.arrayType!);
969 +
          const value = BigQuery._getValue(itemValue, parameterType.arrayType!);
968 970
          if (is.object(value) || is.array(value)) {
969 971
            if (is.array(providedType)) {
970 972
              providedType = providedType as [];
@@ -996,19 +998,26 @@
Loading
996 998
        {}
997 999
      );
998 1000
    } else {
999 -
      queryParameter.parameterValue!.value = getValue(value, parameterType);
1001 +
      queryParameter.parameterValue!.value = BigQuery._getValue(
1002 +
        value,
1003 +
        parameterType
1004 +
      );
1000 1005
    }
1001 1006
1002 1007
    return queryParameter;
1008 +
  }
1003 1009
1004 -
    // eslint-disable-next-line @typescript-eslint/no-explicit-any
1005 -
    function getValue(value: any, type: ValueType): any {
1006 -
      return isCustomType(type) ? value.value : value;
1007 -
    }
1010 +
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1011 +
  private static _getValue(value: any, type: ValueType): any {
1012 +
    return BigQuery._isCustomType(type) ? value.value : value;
1013 +
  }
1008 1014
1009 -
    function isCustomType({type}: ValueType): boolean {
1010 -
      return type!.indexOf('TIME') > -1 || type!.indexOf('DATE') > -1;
1011 -
    }
1015 +
  private static _isCustomType({type}: ValueType): boolean {
1016 +
    return (
1017 +
      type!.indexOf('TIME') > -1 ||
1018 +
      type!.indexOf('DATE') > -1 ||
1019 +
      type!.indexOf('GEOGRAPHY') > -1
1020 +
    );
1012 1021
  }
1013 1022
1014 1023
  createDataset(

Everything is accounted for!

No changes detected that need to be reviewed.
What changes does Codecov check for?
Lines, not adjusted in diff, that have changed coverage data.
Files that introduced coverage data that had none before.
Files that have missing coverage data that once were tracked.
Files Coverage
src +<.01% 98.94%
.mocharc.js 79.31%
.prettierrc.js 0.00%
Project Totals (9 files) 98.60%
Loading