Description
We can't seem to pass a string containing a comma surrounded by parentheses as model-extra-attributes in sea-orm-cli. This becomes a problem when you want to pass cfg_attr(predicate, attribute), for instance.
Steps to Reproduce
$ sea-orm-cli generate entity --model-extra-attributes 'test(a, b)' -u 'postgres://username:password@localhost/dbname'
Expected Behavior
Since the following does work and produces Models with #[test(a)], I guess test(a, b) should also work.
$ sea-orm-cli generate entity --model-extra-attributes 'test(a)' -u 'postgres://username:password@localhost/dbname'
Actual Behavior
$ RUST_BACKTRACE=1 sea-orm-cli generate entity --model-extra-attributes 'test(a, b)' -u 'postgres://username:password@localhost/dbname'
Connecting to Postgres ...
Discovering schema ...
... discovered.
thread 'main' panicked at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/sea-orm-codegen-0.12.10/src/entity/writer.rs:108:57:
called `Result::unwrap()` on an `Err` value: LexError { span: Span }
stack backtrace:
0: rust_begin_unwind
at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/panicking.rs:597:5
1: core::panicking::panic_fmt
at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/core/src/panicking.rs:72:14
2: core::result::unwrap_failed
at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/core/src/result.rs:1652:5
3: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
4: sea_orm_codegen::entity::writer::EntityWriterContext::new
5: sea_orm_cli::commands::generate::run_generate_command::{{closure}}
6: async_std::task::task_locals_wrapper::TaskLocalsWrapper::set_current
7: <futures_lite::future::Or<F1,F2> as core::future::future::Future>::poll
8: async_io::driver::block_on
9: async_global_executor::executor::block_on
10: async_std::task::task_locals_wrapper::TaskLocalsWrapper::set_current
11: async_std::task::builder::Builder::blocking
12: sea_orm_cli::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Reproduces How Often
This is always reproducible.
Workarounds
There's no workaround as far as I'm aware (except manual string processing for generated entities)
Reproducible Example
- Create a postgres database and a table
$ sudo -u postgres psql --command="CREATE DATABASE test_db OWNER postgres_user encoding = 'UTF8';"
$ sudo -u postgres psql --dbname=test_db --command='CREATE TABLE test_table ("test_column" character varying(32));'
- Generate entities
$ sea-orm-cli generate entity --model-extra-attributes 'test(a, b)' -u 'postgres://postgres_user:password/test_db'
Connecting to Postgres ...
Discovering schema ...
... discovered.
thread 'main' panicked at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/sea-orm-codegen-0.12.10/src/entity/writer.rs:108:57:
called `Result::unwrap()` on an `Err` value: LexError { span: Span }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Versions
$ cargo tree | grep sea
├── sea-orm v0.12.10
│ ├── sea-orm-macros v0.12.10 (proc-macro)
│ │ ├── sea-bae v0.2.0 (proc-macro)
│ ├── sea-query v0.30.5
│ ├── sea-query-binder v0.5.0
│ │ ├── sea-query v0.30.5 (*)
$ psql --version
psql (PostgreSQL) 16.1
Description
We can't seem to pass a string containing a comma surrounded by parentheses as
model-extra-attributesin sea-orm-cli. This becomes a problem when you want to passcfg_attr(predicate, attribute), for instance.Steps to Reproduce
Expected Behavior
Since the following does work and produces
Models with#[test(a)], I guesstest(a, b)should also work.Actual Behavior
Reproduces How Often
This is always reproducible.
Workarounds
There's no workaround as far as I'm aware (except manual string processing for generated entities)
Reproducible Example
Versions