• 6 Posts
  • 14 Comments
Joined 3 years ago
cake
Cake day: June 13th, 2023

help-circle
  • I do believe that it is possible to translate any SQL query to Lutra, that is Lutra can cover that last 1% of cases. There are a few caveats:

    • Some cases would produce very verbose Lutra code because they have special-case syntax in SQL, which makes them terse.
    • Lutra does not cover DDL (CREATE, ALTER, DROP, ADMINISTER). That’s because Lutra is conceptually a “run-time” language for dealing with data and not schema modifications. Because of this, Lutra cannot be used for migrations.
    • Lutra is still in development, so you are likely to find cases that are not yet expressible. If you do, please report them, so they can be implemented. But I don’t believe that there are cases that would conceptually clash with Lutra language design, like there are with most ORMs.

  • Two great questions!

    First one comes down to how database query optimization and predicate pushdown in particular. In this case, albums would probably have an index on albums.id column, which would optimize get_album_by_id into a single index lookup. Ideally, I would want to have an explicit function for this, something like sql::from_index("albums", "id", 3), but there is no such thing as explicit index lookup in PostgreSQL right now.

    Regarding different function syntaxes:

    • curly braces { ... } construct a new tuple (think object, struct, record),
    • parenthesis are used for precedence. They are not strictly needed for function bodies, but they do give a better visual guide to multi-line definitions, especially when using pipe operator.

    So:

    func something() -> { ... }  # constructs a new tuple
    func something() -> ( ... )  # returns a value
    func something() -> ...      # equivalent to ( ... )
    












  • verstra@programming.devtoMemes@lemmy.mlCheckmate dronies
    link
    fedilink
    arrow-up
    2
    arrow-down
    2
    ·
    7 months ago

    To be honest, I know little about Mao and beginnings of PRC - I’m quite ignorant about how much of an “absolute leader” he was.

    But I do believe that idolizing a person and concentration of power are dangerous to democracy.

    And it’s interesting how much responses I got on this topic.