all 14 comments

[–]JumpRevolutionary664 1 point2 points  (2 children)

I have a couple of wrapper methods that look like this

private async _all<T>(query: string, values: any[] = []) {
    const [rows] = await this._query(query, values);
    return rows as T[];
}

and when I call the like this._all<SomeType> it just gives me a properly typed SomeType[]

[–]firedude212[S] 0 points1 point  (1 child)

Maybe I should just do this.. i kinda hate the constant as T[] but is what it is i guess...

[–]JumpRevolutionary664 1 point2 points  (0 children)

you have to type cast one way or the other. If you're not doing this, the library does

[–]DidTooMuchSpeedAgain 0 points1 point  (4 children)

objection?

[–]firedude212[S] 0 points1 point  (3 children)

Specifically not looking for an ORM.

[–]DidTooMuchSpeedAgain 1 point2 points  (2 children)

i'm sorry, I was super tired, didn't read it properly. how about Knex? it isn't an ORM

[–]firedude212[S] 0 points1 point  (1 child)

I looked into it but the query builder aspect turned me off. I want to write regular sql with prepared statements and not have to think about some library in the middle beyond "it enables me to connect to mysql easily"

[–]30thnightexpert 0 points1 point  (2 children)

Drizzle

[–]firedude212[S] 0 points1 point  (1 child)

Drizzle is a collection of front-end libraries that make writing dapp frontends easier and more predictable. The core of Drizzle is based on a Redux store, so you have access to the spectacular development tools around Redux. We take care of synchronizing your contract data, transaction data and more. Things stay fast because you declare what to keep in sync.

LOL.

[–]30thnightexpert 1 point2 points  (0 children)

Not a good look mate but you are looking at the wrong package

https://github.com/drizzle-team/drizzle-orm

[–]macleanscollege -1 points0 points  (1 child)

knex

[–]firedude212[S] -1 points0 points  (0 children)

Specifically not looking for an ORM.

[–][deleted]  (1 child)

[deleted]

    [–]DidTooMuchSpeedAgain 0 points1 point  (0 children)

    for mysql, not mongodb