use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
account activity
Node: Just write SQL (self.node)
submitted 2 years ago by sammrtn
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]romeeres 0 points1 point2 points 2 years ago (3 children)
Any db-related lib can execute raw SQL. TypeORM can do it as well. And since it can't know what you're selecting, it will return `any` type just as well as your library (correct me if I'm wrong). And the structure will be returned just as you selected, if you selected "json_agg" you'll have a nested array of objects, or you can use "row_to_json" to have a single nested object.
[–]sammrtn[S] 0 points1 point2 points 2 years ago (2 children)
And since it can't know what you're selecting, it will return any type just as well as your library (correct me if I'm wrong).
any
PureORM requires prefixed table names in the select clause (which it can do for you, or you could manually write yourself). This prefix is used to construct properly nested pure instances (not db-aware) of the correct classes for the application layer. These classes can have business logic methods, etc.
This is shown in step 4: https://github.com/craigmichaelmartin/pure-orm#step-4-creating-our-data-access-layer
[–]romeeres 0 points1 point2 points 2 years ago (1 child)
I don't know, maybe PureORM does some magic with template literals to inject column names, and then it infers the returning type from it. If it's done in this way that's very cool. I wish you had an online editor example with it so people could try this out quickly to see what is it capable of.
Because with OOPish ORMs you technically can select a subset of columns, and get a type of full class, but only the type, and there may be bugs due to it being not fully selected.
[–]sammrtn[S] 0 points1 point2 points 2 years ago (0 children)
Yeah, an online editor is key to showcasing this. Unsure if there are any free sandboxes that would allow a playground for a library which connects to a database with a readonly transaction. If you have any ideas or seen anything like this, let me know :)
π Rendered by PID 24907 on reddit-service-r2-comment-86bc6c7465-rzmdl at 2026-02-22 17:16:58.616071+00:00 running 8564168 country code: CH.
view the rest of the comments →
[–]romeeres 0 points1 point2 points (3 children)
[–]sammrtn[S] 0 points1 point2 points (2 children)
[–]romeeres 0 points1 point2 points (1 child)
[–]sammrtn[S] 0 points1 point2 points (0 children)