Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
rabidferret
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
8 ms
·
31.
▲
by
rabidferret
8y ago
Calling `std::process:exit(1)` at the end of main is identical to `return 1`. I'm not sure what your point is with `env_logger::init`. It sounds like you think destructors are run on static items? They aren't. In fact, until very
32.
▲
by
rabidferret
8y ago
Unless I'm misunderstanding you, [`std::process::exit`]( https://doc.rust-lang.org/nightly/std/process/fn.exit.html ) does what you want.
33.
▲
by
rabidferret
9y ago
Just wanted to mention that your usage of `sql_query` is exactly how it's meant to be used, and exactly where I would reach for it. Great article!
34.
▲
Announcing Diesel 1.0 – A Safe, Extensible Query Builder and ORM
(medium.com)
25 points
by
rabidferret
9y ago
|
0 comments
35.
▲
by
rabidferret
9y ago
Can you elaborate on how Diesel doesn't compose in this way? Composition is one of the main goals of Diesel.
36.
▲
by
rabidferret
9y ago
If you open an issue we can up the limit again
37.
▲
by
rabidferret
9y ago
I think people read way too much into the ORM label. Diesel is very much a query builder first, not an ORM. As a random data point, I've been fixing bugs in Rails lately by basically copying over code from Diesel and converting it to R
38.
▲
by
rabidferret
9y ago
We didn't want to commit to our own home-grown hlist type until we had some indicator of whether the language was going to go with variadics based on tuples or hlists.
39.
▲
by
rabidferret
9y ago
It'll eventually go away when some form of variadic generics lands in the language
40.
▲
by
rabidferret
9y ago
Ironically, I was actually originally planning on having Diesel primarily built around parsing actual SQL. (See the commit message of https://github.com/diesel-rs/diesel/commit/2ba8bf481c3d21d8b... , which is
41.
▲
by
rabidferret
9y ago
Slick was definitely an influence on Diesel's design. I tried to have our query builder map more closely to SQL though, whereas Slick feels like it's trying to pretend it's just an Iterable.
42.
▲
by
rabidferret
9y ago
You could just as easily write `posts.filter(user_id.eq(1)).load(&connection)`.
43.
▲
by
rabidferret
9y ago
Not a HashMap specifically, but there is a way to group them into `Vec<(User, Vec<(Post, Vec<Comment>)>)>`. (Which you can convert into a hashmap pretty easily) http://docs.diesel.rs/diesel/association
44.
▲
by
rabidferret
9y ago
Uh... Custom derive?
45.
▲
by
rabidferret
9y ago
"requires unsafe" already implies everything in your comment. `unsafe` literally means "this might violate memory safety"
46.
▲
by
rabidferret
10y ago
That doesn't mean that a 500 is a good UX. We give error messages on invalid form input for a reason.
47.
▲
by
rabidferret
10y ago
Yeah, ultimately it's fundamentally no different than Go but with more sugar and ability to abstract properly. Turns out that counts for a lot.
48.
▲
by
rabidferret
10y ago
I think that's only the case when you are specifically trying to avoid boxing.
49.
▲
by
rabidferret
10y ago
Just because a type can be named doesn't mean that returning the named type properly expresses your intent. The name of said type can get real hairy real fast, as well.
50.
▲
by
rabidferret
10y ago
> it's almost never required Mate you should try Diesel or Futures. ;)
51.
▲
by
rabidferret
10y ago
Most in depth I went was probably in http://m.youtube.com/watch?v=PUuYAksQWg4 but I discuss it in pretty much every talk I give. You can also just ping me on Twitter and I can talk about it more. :)
52.
▲
by
rabidferret
10y ago
I talk about this at length in one of my recent talks but the short version is we wanted to optimize for reuse via named scopes
53.
▲
by
rabidferret
10y ago
For an insurance policy like that, they wouldn't offer any policy without auditing the device, including the code.
54.
▲
Diesel's query builder is now faster than using raw SQL
(github.com)
12 points
by
rabidferret
10y ago
|
0 comments
55.
▲
by
rabidferret
11y ago
This isn't true at all. You can add as many fields as you want. You'll need to recompile to use them, of course.
56.
▲
by
rabidferret
11y ago
That is our `sql` function
57.
▲
by
rabidferret
11y ago
It's impossible. We can't guarantee the order of the result set, so we'd have to iterate the entire collection just to implement `next`
58.
▲
by
rabidferret
11y ago
Hah I love this answer. ^_^
59.
▲
by
rabidferret
11y ago
We have a SQL literal ast node but you lose most of the benefits of the library that way
60.
▲
by
rabidferret
11y ago
> And rusqlite (or libsqlite-3) doesn't have those issues? rusqlite has the same issues. libsqlite doesn't since it's just C bindings. Same as pq_sys. Ironically, rusqlite makes the same design choices as rust-postgres, bu
More ›