nushell/crates
Doru d1a8992590
Initial --params implementation (#12249)
# Description
This PR adds a `--params` param to `query db`. This closes #11643.

You can't combine both named and positional parameters, I think this
might be a limitation with rusqlite itself. I tried using named
parameters with indices like `{ ':named': 123, '1': "positional" }` but
that always failed with a rusqlite error. On the flip side, the other
way around works: for something like `VALUES (:named, ?)`, you can treat
both as positional: `-p [hello 123]`.

This PR introduces some very gnarly code repetition in
`prepared_statement_to_nu_list`. I tried, I swear; the compiler wasn't
having any of it, it kept telling me to box my closures and then it said
that the reference lifetimes were incompatible in the match arms. I gave
up and put the mapping code in the match itself, but I'm still not
happy.

Another thing I'm unhappy about: I don't like how you have to put the
`:colon` in named parameters. I think nushell should insert it if it's
[missing](https://www.sqlite.org/lang_expr.html#parameters). But this is
the way [rusqlite
works](https://docs.rs/rusqlite/latest/rusqlite/trait.Params.html#example-named),
so for now, I'll let it be consistent. Just know that it's not really a
blocker, and it isn't a compatibility change to later make `{ colon: 123
}` work, without the quotes and `:`. This would require allocating and
turning our pretty little `&str` into a `String`, though

# User-Facing Changes
Less incentive to leave yourself open to SQL injection with statements
like `query db $"INSERT INTO x VALUES \($unsafe_user_input)"`.
Additionally, the `$""` syntax being annoying with parentheses plays in
our favor, making users even more likely to use ? with `--params`.

# Tests + Formatting
Hehe
2024-03-24 15:40:21 -05:00
..
nu_plugin_custom_values Move more dependencies to workspace level (#12270) 2024-03-23 18:46:02 -05:00
nu_plugin_example Support for getting help text from a plugin command (#12243) 2024-03-24 07:30:38 +08:00
nu_plugin_formats Move more dependencies to workspace level (#12270) 2024-03-23 18:46:02 -05:00
nu_plugin_gstat Better generic errors for plugins (and perhaps scripts) (#12236) 2024-03-21 12:27:21 +01:00
nu_plugin_inc Better generic errors for plugins (and perhaps scripts) (#12236) 2024-03-21 12:27:21 +01:00
nu_plugin_python Improve the error message for a plugin version mismatch (#12122) 2024-03-08 06:04:22 -06:00
nu_plugin_query Support for getting help text from a plugin command (#12243) 2024-03-24 07:30:38 +08:00
nu-cli Move more dependencies to workspace level (#12270) 2024-03-23 18:46:02 -05:00
nu-cmd-base Move more dependencies to workspace level (#12270) 2024-03-23 18:46:02 -05:00
nu-cmd-dataframe Move more dependencies to workspace level (#12270) 2024-03-23 18:46:02 -05:00
nu-cmd-extra Move more dependencies to workspace level (#12270) 2024-03-23 18:46:02 -05:00
nu-cmd-lang Move more dependencies to workspace level (#12270) 2024-03-23 18:46:02 -05:00
nu-color-config Move more dependencies to workspace level (#12270) 2024-03-23 18:46:02 -05:00
nu-command Initial --params implementation (#12249) 2024-03-24 15:40:21 -05:00
nu-engine Make EngineState clone cheaper with Arc on all of the heavy objects (#12229) 2024-03-19 19:07:00 +01:00
nu-explore Move more dependencies to workspace level (#12270) 2024-03-23 18:46:02 -05:00
nu-glob Fix ignored clippy lints (#12160) 2024-03-11 19:46:04 +01:00
nu-json Move more dependencies to workspace level (#12270) 2024-03-23 18:46:02 -05:00
nu-lsp 🐛 remove 3 backticks messing the hover (#12273) 2024-03-24 14:15:01 -05:00
nu-parser Move more dependencies to workspace level (#12270) 2024-03-23 18:46:02 -05:00
nu-path Move more dependencies to workspace level (#12270) 2024-03-23 18:46:02 -05:00
nu-plugin Move more dependencies to workspace level (#12270) 2024-03-23 18:46:02 -05:00
nu-plugin-test-support Add test support crate for plugin developers (#12259) 2024-03-23 13:29:54 -05:00
nu-pretty-hex nu-explore/ Use hex-dump for binary data (#12184) 2024-03-21 19:02:03 -05:00
nu-protocol Move more dependencies to workspace level (#12270) 2024-03-23 18:46:02 -05:00
nu-std to json -r not removing whitespaces fix (#11948) 2024-03-20 22:14:31 +01:00
nu-system Move more dependencies to workspace level (#12270) 2024-03-23 18:46:02 -05:00
nu-table Move more dependencies to workspace level (#12270) 2024-03-23 18:46:02 -05:00
nu-term-grid Move more dependencies to workspace level (#12270) 2024-03-23 18:46:02 -05:00
nu-test-support Move more dependencies to workspace level (#12270) 2024-03-23 18:46:02 -05:00
nu-utils Move more dependencies to workspace level (#12270) 2024-03-23 18:46:02 -05:00
README.md Remove old nushell/merge engine-q 2022-02-07 14:54:06 -05:00

Nushell core libraries and plugins

These sub-crates form both the foundation for Nu and a set of plugins which extend Nu with additional functionality.

Foundational libraries are split into two kinds of crates:

  • Core crates - those crates that work together to build the Nushell language engine
  • Support crates - a set of crates that support the engine with additional features like JSON support, ANSI support, and more.

Plugins are likewise also split into two types:

  • Core plugins - plugins that provide part of the default experience of Nu, including access to the system properties, processes, and web-connectivity features.
  • Extra plugins - these plugins run a wide range of different capabilities like working with different file types, charting, viewing binary data, and more.