8000 db.query docs outdated · Issue #473 · romeerez/orchid-orm · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content 8000
db.query docs outdated #473
Open
Open
@IlyaSemenov

Description

@IlyaSemenov

db.query jsdoc suggests this syntax:

* const result = await db.query<{ one: number }>({
* raw: 'SELECT $1 AS one',
* values: [value],
* });

However, it doesn't work both type wise and crashes in runtime with:

 ERROR  (0.6ms) undefined Error: syntax error at or near "undefined"

I figured the correct code would be:

import { raw } from "orchid-orm"

const result = await db.query<{ one: number }>(raw({ 
 raw: 'SELECT $1 AS one', 
 values: [value], 
}));

So I think the docs should be updated accordingly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0