Comments (5)
This should not be a bug, because it's been this way since 0.1. As you already know, there are two workarounds:
- do
node::Column
- do
<Node as EntityTrait>::Column
But you've made an interesting observation, and the solution is right here! Nobody is using PrimaryKeyToColumn
directly, as I imagine, so we can actually afford to break PrimaryKeyToColumn
by renaming Column
to something else. And now is probably the last time I'd change the Entity type system.
from sea-orm.
PrimaryKeyToColumn by renaming Column to something else
Can you open a PR on this? I want to make this change
from sea-orm.
I apologize for my significant mistake. Renaming can't solve this problem. Actually, this problem would never be solved.
Look at this code:
trait T1 {
type Name;
}
struct MyStruct {}
impl T1 for MyStruct {
type Name = i32;
}
fn main() {
let v: MyStruct::Name = 12;
}
Just one trait and just one associate type, but also get:
Compiling playground v0.0.1 (/playground)
error[E0223]: ambiguous associated type
--> src/main.rs:13:12
|
13 | let v: MyStruct::Name = 12;
| ^^^^^^^^^^^^^^ help: use fully-qualified syntax: `<MyStruct as T1>::Name`
For more information about this error, try `rustc --explain E0223`.
error: could not compile `playground` (bin "playground") due to 1 previous error
It can be seen that the ambiguous associated type error is unrelated to associate types with duplicate names. It's easy to understand: If Rust allows to access associate type without fully-qualified syntax, any lib user who define an associate type with duplicate names would cause a break inside the lib.
As a conclusion, perhaps accessing associate types from outside of the trait must use fully-qualified syntax like <MyStruct as T1>::Name
. So this issue dosen't point out any improvement points.
from sea-orm.
There was a discussion around this before, but I couldn't seem to find it.
from sea-orm.
Found it rust-lang/rust#8995
from sea-orm.
Related Issues (20)
- SQLite: Format of DateTimeUtc is wrong HOT 15
- mismatched types, sqlx_postgres::types::oid::Oid>` (as SQL type `OID`) is not compatible with SQL type `INT4` in PostgreSQL
- Vulnerability in the `rsa` (a recursive dependency of SeaORM) HOT 2
- Issue when using `on_conflict` with sqlite HOT 1
- Syntax error when trying to drop multiple tables in migrations with SQLite HOT 1
- does postgres int8 work? HOT 2
- [Testing] Error: `A null value was encountered while decoding "num_items"` when testing pagination and counting HOT 1
- support sqlx v0.8 HOT 1
- sea-orm-cli 1.0 doesn't support mysql type: `bit` HOT 2
- VarBinary(16) column breaks DeriveEntityModel derive
- sea-orm-cli 1.0 generate entity from mysql generates String for MediumBlob fields
- Timezone offset information lost when reading a ChronoDateTimeWithTimeZone HOT 1
- Cannot run sea-orm-cli with feature codegen without sqlite as a dependency HOT 1
- `schema::custom()` requires `col` and `name` to be of same type
- Vec<RoleEnum> in SeaORM Entity Model Causes Compilation Error HOT 1
- No reference to features list or alternate DB connectors in docs.
- Support for `HashMap`
- `sea-orm-migration` is missing the `sqlx-all` feature
- Incorrect type in entity generation
- `ColumnDef` builder functions in `sea-orm-migration` may push additional statements instead of changing them 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.