nebeker

joined 10 months ago
[–] nebeker 2 points 3 months ago (1 children)

If you’re interested in learning more about SQL, throwing EXPLAIN at your query and the AI’s version may be really interesting.

I’m usually perfectly happy trusting my ORM, but even then it’s really helpful to dig a little deeper to figure things out, both in development and in production.

[–] nebeker 1 points 5 months ago

I used that and Rustlings and really liked both, but somebody mentioned this and I decided to take a look. It’s cool that it introduces other concepts.

[–] nebeker 4 points 5 months ago (2 children)

I’m working through rust-exercises.com and taking notes on my thoughts. I may or may not want to use it for a short workshop at work - mostly for fun, since I work with a very different stack.

So far, I don’t know if I like the exercises, because the target audience doesn’t feel like it’s clearly defined: you both solve is_even with an if/else and overflow an i8 to -1. I don’t think I’ve met the person who is that inexperienced and that knowledgeable…

How are folks liking these exercises?

[–] nebeker 1 points 5 months ago (1 children)

I’m inferring based on the deprecation of YEAR(4) and the conversion time window that obviously needs to be updated at some point.

[–] nebeker 3 points 5 months ago (3 children)

To answer the part of your question I think is most fun, there is a standard for SQL. There are many dialects of SQL, but you’ll often hear of “ANSI SQL.” The latest version is SQL:2023.

Looking at the MySQL manual entry for the YEAR type, I think we can conclude two things:

  1. The developers consider the possibility of deprecating and removing support for time data type features;

  2. They use “reasonable defaults” for conversions of 2 digit years, based on the current year.

The good news is it sounds like this issue is being taken into account. I’m sure the conversion window will be adjusted in future version and the data type may be changed or deprecated altogether. I wouldn’t be surprised if they added a YEAR2 though. T-SQL has a datetime2, after all.

[–] nebeker 1 points 6 months ago (1 children)

One of my main concerns with this is the potential for making a lot of separate calls to the DB for a complex data structure. Then again there are trade offs to any architecture.

[–] nebeker 1 points 6 months ago* (last edited 6 months ago) (3 children)

The insert on their Getting Started guide.

let new_post = NewPost { title, body };

diesel::insert_into(posts::table)
    .values(&new_post)
    .returning(Post::as_returning())
    .get_result(conn)
    .expect("Error saving new post")

Of course the other possibility is this guide is very low on abstractions.

[–] nebeker 7 points 6 months ago (5 children)

Just learning. I threw together a little CRUD API in Rocket the other day.

Now I’m playing around with Diesel. I don’t love the intermediate New types, coming from EF Core. Is that because Rust ~~~~doesn’t really have constructors?

view more: ‹ prev next ›