Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: gajus/slonik
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v33.3.3
Choose a base ref
...
head repository: gajus/slonik
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v34.0.0
Choose a head ref
  • 1 commit
  • 13 files changed
  • 1 contributor

Commits on Jun 7, 2023

  1. feat: remove copyFromBinary

    BREAKING CHANGE: This feature should have been removed long time ago. It is poorly implemented and barely used. If you have a requirement for copyFromBinary I suggest using the underlying library directly.
    gajus committed Jun 7, 2023
    Copy the full SHA
    e0f92cb View commit details
59 changes: 0 additions & 59 deletions .README/QUERY_METHODS.md
Original file line number Diff line number Diff line change
@@ -48,65 +48,6 @@ pool.oneFirst(sql.unsafe`
`)
```

### `copyFromBinary`

```ts
(
streamQuery: QuerySqlToken,
tupleList: any[][],
columnTypes: TypeNameIdentifier[],
) => Promise<null>;
```

Copies from a binary stream.

The binary stream is constructed using user supplied `tupleList` and `columnTypes` values.

Example:

```ts
const tupleList = [
[
1,
'baz'
],
[
2,
'baz'
]
];

const columnTypes = [
'int4',
'text'
];

await connection.copyFromBinary(
sql.unsafe`
COPY foo
(
id,
baz
)
FROM STDIN BINARY
`,
tupleList,
columnTypes
);
```

#### Limitations

* Tuples cannot contain `NULL` values.

#### Implementation notes

`copyFromBinary` implementation is designed to minimize the query execution time at the cost of increased script memory usage and execution time. This is achieved by separating data encoding from feeding data to PostgreSQL, i.e. all data passed to `copyFromBinary` is first encoded and then fed to PostgreSQL (contrast this to using a stream with encoding transformation to feed data to PostgreSQL).

#### Related documentation

* [`COPY` documentation](https://www.postgresql.org/docs/current/sql-copy.html)

### `many`

Returns result rows.
68 changes: 0 additions & 68 deletions README.md
Original file line number Diff line number Diff line change
@@ -126,7 +126,6 @@ Note: Using this project does not require TypeScript. It is a regular ES6 module
* [`any`](#user-content-slonik-query-methods-any)
* [`anyFirst`](#user-content-slonik-query-methods-anyfirst)
* [`exists`](#user-content-slonik-query-methods-exists)
* [`copyFromBinary`](#user-content-slonik-query-methods-copyfrombinary)
* [`many`](#user-content-slonik-query-methods-many)
* [`manyFirst`](#user-content-slonik-query-methods-manyfirst)
* [`maybeOne`](#user-content-slonik-query-methods-maybeone)
@@ -2324,73 +2323,6 @@ pool.oneFirst(sql.unsafe`
`)
```

<a name="user-content-slonik-query-methods-copyfrombinary"></a>
<a name="slonik-query-methods-copyfrombinary"></a>
### <code>copyFromBinary</code>

```ts
(
streamQuery: QuerySqlToken,
tupleList: any[][],
columnTypes: TypeNameIdentifier[],
) => Promise<null>;
```

Copies from a binary stream.

The binary stream is constructed using user supplied `tupleList` and `columnTypes` values.

Example:

```ts
const tupleList = [
[
1,
'baz'
],
[
2,
'baz'
]
];

const columnTypes = [
'int4',
'text'
];

await connection.copyFromBinary(
sql.unsafe`
COPY foo
(
id,
baz
)
FROM STDIN BINARY
`,
tupleList,
columnTypes
);
```

<a name="user-content-slonik-query-methods-copyfrombinary-limitations"></a>
<a name="slonik-query-methods-copyfrombinary-limitations"></a>
#### Limitations

* Tuples cannot contain `NULL` values.

<a name="user-content-slonik-query-methods-copyfrombinary-implementation-notes"></a>
<a name="slonik-query-methods-copyfrombinary-implementation-notes"></a>
#### Implementation notes

`copyFromBinary` implementation is designed to minimize the query execution time at the cost of increased script memory usage and execution time. This is achieved by separating data encoding from feeding data to PostgreSQL, i.e. all data passed to `copyFromBinary` is first encoded and then fed to PostgreSQL (contrast this to using a stream with encoding transformation to feed data to PostgreSQL).

<a name="user-content-slonik-query-methods-copyfrombinary-related-documentation"></a>
<a name="slonik-query-methods-copyfrombinary-related-documentation"></a>
#### Related documentation

* [`COPY` documentation](https://www.postgresql.org/docs/current/sql-copy.html)

<a name="user-content-slonik-query-methods-many"></a>
<a name="slonik-query-methods-many"></a>
### <code>many</code>
Loading