Comments (1)
I also encountered the same problem
sea-orm-cli generate entity -o entity/src -l -u postgres://postgres:postgres@localhost:22732/postgres
--with-serde both
--model-extra-attributes='graphql(concrete(name = "Favorite",params()))'
--model-extra-derives async_graphql::SimpleObject
result
yexiyue@wisteriadeMacBook-Pro graphql-study % sea-orm-cli generate entity -o entity/src -l -u postgres://postgres:postgres@localhost:22732/postgres --with-serde both --model-extra-attributes='graphql(concrete(name = "Favorite",params()))' --model-extra-derives async_graphql::SimpleObject
Connecting to Postgres ...
Discovering schema ...
... discovered.
thread 'main' panicked at /Users/yexiyue/.cargo/registry/src/mirrors.sjtug.sjtu.edu.cn-be2141875385cea5/sea-orm-codegen-0.12.14/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
When I remove the comma before params, it can work properly
However, there are still spaces in front, which is not very aesthetically pleasing
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.14
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(
Clone,
Debug,
PartialEq,
DeriveEntityModel,
Eq,
Serialize,
Deserialize,
async_graphql :: SimpleObject,
)]
#[sea_orm(table_name = "favorite")]
#[graphql(concrete(name = "Favorite"params()))]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub user_id: i32,
#[sea_orm(primary_key, auto_increment = false)]
pub action_id: i32,
pub create_time: Option<DateTime>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(
belongs_to = "super::actions::Entity",
from = "Column::ActionId",
to = "super::actions::Column::Id",
on_update = "Cascade",
on_delete = "Cascade"
)]
Actions,
#[sea_orm(
belongs_to = "super::user::Entity",
from = "Column::UserId",
to = "super::user::Column::Id",
on_update = "Cascade",
on_delete = "Cascade"
)]
User,
}
impl Related<super::actions::Entity> for Entity {
fn to() -> RelationDef {
Relation::Actions.def()
}
}
impl Related<super::user::Entity> for Entity {
fn to() -> RelationDef {
Relation::User.def()
}
}
impl ActiveModelBehavior for ActiveModel {}
from sea-orm.
Related Issues (20)
- `sea-orm-migration` CLI shouldn't always connect to a database
- FromJsonQueryResult should also work with generic types HOT 1
- sea-orm-cli generates uncompilable model from pre-existing autoincrement primary key in sqlite
- Surprising ordering of native MySQL enums
- DataLoader load_many and load_many_to_many can't handle capital letters in column name
- Using DeriveIden for enum HOT 3
- Less verbose migration HOT 3
- `referential_key_table_name` empty for multi-column index (Option::unwrap on None during migration)
- `enum`s are always lowercased in queries despire `enum_name` leading to `type does not exist` HOT 2
- Entity Generation Fails to Skip Ignored Tables HOT 3
- DateTimeUtc is recognized as TimestampWithTimeZone HOT 1
- (maybe bug) PaginatorTrait does not apply to generic method. HOT 1
- can sea-orm-cli generate model support model field name camel case option?
- Shared lock syntax incompatible with MariaDB
- SeaORM issue with UUID stored as binary(16) in MySQL
- [BUG] `DerivePartialModel` attr `entity` not support `syn::Path` token HOT 3
- Field name 'is_2fa' converted to 'is2fa' during insertion in SeaORM HOT 3
- Missing primary_key attributes when generating from a DB with partitions HOT 2
- doc: code blocks looks weird in light mode HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sea-orm.