Skip to content

Commit

Permalink
Merge pull request #175 from deno-postgres/1.4.0
Browse files Browse the repository at this point in the history
Update to 1.4.0 and workaround TS1371
  • Loading branch information
hayd authored Sep 16, 2020
2 parents f19e520 + e313969 commit e5c619a
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Install deno
uses: denolib/setup-deno@master
with:
deno-version: 1.2.2
deno-version: 1.4.0

- name: Check formatting
run: deno fmt --check
Expand Down
4 changes: 4 additions & 0 deletions array_parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,22 @@
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

// deno-lint-ignore ban-types
export function parseArray(source: string, transform: Function | undefined) {
return new ArrayParser(source, transform).parse();
}

class ArrayParser {
source: string;
// deno-lint-ignore ban-types
transform: Function;
position = 0;
entries: Array<unknown> = [];
recorded: Array<unknown> = [];
dimension = 0;

// deno-lint-ignore ban-types
constructor(source: string, transform: Function | undefined) {
this.source = source;
this.transform = transform || identity;
Expand Down
2 changes: 1 addition & 1 deletion connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import { hashMd5Password, readUInt32BE } from "./utils.ts";
import { PacketReader } from "./packet_reader.ts";
import { QueryConfig, QueryResult, Query } from "./query.ts";
import { parseError } from "./error.ts";
import { ConnectionParams } from "./connection_params.ts";
import type { ConnectionParams } from "./connection_params.ts";
import { DeferredStack } from "./deferred.ts";

export enum Format {
Expand Down
3 changes: 2 additions & 1 deletion decode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ function decodeByteaHex(byteaStr: string): Uint8Array {
function decodeByteaEscape(byteaStr: string): Uint8Array {
let bytes = [];
let i = 0;
let k = 0;
while (i < byteaStr.length) {
if (byteaStr[i] !== "\\") {
bytes.push(byteaStr.charCodeAt(i));
Expand All @@ -166,7 +167,7 @@ function decodeByteaEscape(byteaStr: string): Uint8Array {
) {
backslashes++;
}
for (var k = 0; k < Math.floor(backslashes / 2); ++k) {
for (k = 0; k < Math.floor(backslashes / 2); ++k) {
bytes.push(BACKSLASH_BYTE_VALUE);
}
i += Math.floor(backslashes / 2) * 2;
Expand Down
8 changes: 3 additions & 5 deletions deps.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
export {
BufReader,
BufWriter,
} from "https://deno.land/std@0.67.0/io/bufio.ts";
} from "https://deno.land/std@0.69.0/io/bufio.ts";
export { copyBytes } from "https://deno.land/std@0.67.0/bytes/mod.ts";
export {
Deferred,
deferred,
} from "https://deno.land/std@0.67.0/async/deferred.ts";
export { deferred } from "https://deno.land/std@0.69.0/async/deferred.ts";
export type { Deferred } from "https://deno.land/std@0.69.0/async/deferred.ts";
export { createHash } from "https://deno.land/std@0.67.0/hash/mod.ts";
2 changes: 1 addition & 1 deletion error.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Message } from "./connection.ts";
import type { Message } from "./connection.ts";

export interface ErrorFields {
severity: string;
Expand Down
4 changes: 2 additions & 2 deletions query.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { RowDescription, Column, Format } from "./connection.ts";
import { Connection } from "./connection.ts";
import type { RowDescription } from "./connection.ts";
import type { Connection } from "./connection.ts";
import { encode, EncodedArg } from "./encode.ts";

import { decode } from "./decode.ts";
Expand Down
2 changes: 1 addition & 1 deletion tests/constants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ConnectionParams } from "../connection_params.ts";
import type { ConnectionParams } from "../connection_params.ts";

export const DEFAULT_SETUP = [
"DROP TABLE IF EXISTS ids;",
Expand Down
2 changes: 1 addition & 1 deletion tests/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Client } from "../client.ts";
import type { Client } from "../client.ts";

export function getTestClient(
client: Client,
Expand Down
2 changes: 1 addition & 1 deletion tests/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Client } from "../mod.ts";
import { assertEquals } from "../test_deps.ts";
import { DEFAULT_SETUP, TEST_CONNECTION_PARAMS } from "./constants.ts";
import { getTestClient } from "./helpers.ts";
import { QueryResult } from "../query.ts";
import type { QueryResult } from "../query.ts";

const CLIENT = new Client(TEST_CONNECTION_PARAMS);

Expand Down

0 comments on commit e5c619a

Please # to comment.