Code Monkey home page Code Monkey logo

Comments (5)

billy1624 avatar billy1624 commented on May 13, 2024 1

Good point!

from sea-orm.

tyt2y3 avatar tyt2y3 commented on May 13, 2024

Any suggestion on the naming convention? How about an underscore at the end?

from sea-orm.

tqwewe avatar tqwewe commented on May 13, 2024

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.

billy1624 avatar billy1624 commented on May 13, 2024

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.

tqwewe avatar tqwewe commented on May 13, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.