Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

incorrect docs for bun:sqlite Statement.get #11099

Open
1hko opened this issue May 15, 2024 · 0 comments
Open

incorrect docs for bun:sqlite Statement.get #11099

1hko opened this issue May 15, 2024 · 0 comments
Labels
docs Improvements or additions to documentation

Comments

@1hko
Copy link

1hko commented May 15, 2024

What is the type of issue?

No response

What is the issue?

Statement.get docs examples are copypasta of Statement.all -

declare module "bun:sqlite" {
  // ...
  export class Statement<ReturnType = unknown, ParamsType extends SQLQueryBindings[] = any[]> implements Disposable {
    //...
    /**
     * Execute the prepared statement and return **the first** result.
     *
     * If no result is returned, this returns `null`.
     *
     * @param params optional values to bind to the statement. If omitted, the statement is run with the last bound values or no parameters if there are none.
     *
     * @example
     * ```ts
     * const stmt = db.prepare("SELECT * FROM foo WHERE bar = ?");
     *
     * stmt.all("baz");        ❌
     * // => [{bar: "baz"}]    ❌
     *
     * stmt.all();             ❌
     * // => [{bar: "baz"}]    ❌
     *
     * stmt.all("foo");        ❌
     * // => [{bar: "foo"}]    ❌
     * ```
     *
     * The following types can be used when binding parameters:
     *
     * | JavaScript type | SQLite type |
     * | -------------- | ----------- |
     * | `string` | `TEXT` |
     * | `number` | `INTEGER` or `DECIMAL` |
     * | `boolean` | `INTEGER` (1 or 0) |
     * | `Uint8Array` | `BLOB` |
     * | `Buffer` | `BLOB` |
     * | `bigint` | `INTEGER` |
     * | `null` | `NULL` |
     */
    get(...params: ParamsType): ReturnType | null;

    // ...

Where did you find it?

https://github.com/oven-sh/bun/blob/main/packages/bun-types/sqlite.d.ts#L524-L531

@1hko 1hko added the docs Improvements or additions to documentation label May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant