Comments (5)
Good point!
from sea-orm.
Any suggestion on the naming convention? How about an underscore at the end?
from sea-orm.
I didn't make any suggestions for this because I am not sure 😄
I guess type_
with an underscore could work.. or type_col
(adding _col
). I'm not sure of any better options than these.
from sea-orm.
I think we can leave it for the user to decide how to resolve the name conflict.
Personally think that neither r#type
nor type_
be a good option. For me, I would simply choose another name to avoid conflicting with Rust keywords.
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel)]
pub struct Model {
pub id: i32,
pub type_of: String,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveCustomColumn)]
pub enum Column {
Id,
TypeOf,
}
impl IdenStatic for Column {
fn as_str(&self) -> &str {
match self {
Self::TypeOf => "type",
_ => self.default_as_str(),
}
}
}
from sea-orm.
The problem is that users will integrate existing databases with SeaORM.. and usually you don't want your framework / language to dictate your database, it should be flexible enough to avoid issues like this
from sea-orm.
Related Issues (20)
- doc: code blocks looks weird in light mode HOT 7
- Incorrect Route Matching Behavior in Actix Example Code HOT 1
- no column found for name: A_
- Missing okapi support HOT 1
- Insert to mysql, can find data inserted in mysql but the method returns with Err(RecordNotFound("Failed to find inserted item")).
- Issues with tables that do not have primary/unique keys
- Insert an active model and get back the last insert id doesn't work with autoincrement
- Enum column named "model" generates code that conflicts with the struct Model
- ambiguous associated type when access Entity::Column HOT 5
- TimestampWithTimeZone returned as array
- Allow Defaulting `string_value` For ActiveEnum Based On Renaming Rules On Variants HOT 1
- transaction use probelm with state
- Sea-ORM still includes sqlx-mysql dependency even when no mysql feature is enabled
- sea-orm-migration - Compile error using most recent version of rc2 HOT 12
- Missing downward feature `runtime-tokio`. HOT 4
- Mock Auto Increment ID Not Working for Postgres Backend Complaining About Null HOT 1
- sea-orm-cli generate error HOT 1
- .money_len type creates invalid SQL HOT 1
- Compilation error when building with sqlx-sqlite and runtime-async-std-rustls HOT 3
- is Sea orm Json type can't insert text [] type
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.