Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for singularizing entities #32

Open
daniel-gato opened this issue Oct 6, 2022 · 1 comment
Open

Add support for singularizing entities #32

daniel-gato opened this issue Oct 6, 2022 · 1 comment
Labels
feature request New feature or request

Comments

@daniel-gato
Copy link

daniel-gato commented Oct 6, 2022

Hi,

For context: It is quite common to have tables name in their plural form to describe what the table contains. This is the approach that Ruby on Rails takes as well. Our model Car, will be stored in a "cars" table.

Would it be possible to have a "singularise-entities" to turn:

export interface Users {
  id: string;
  email: string;
}

export interface Database {
  users: Users;
}

into

export interface User {
  id: string;
  email: string;
}

export interface Database {
  users: User;
}

The same way that camelCase works?

Another reason to do that is to avoid having mixed types with reserved table names. User table name is not allowed in PG for example. In the same example, from memory, mysql won't allow table names like admin, backup, channel, action

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • We receive the funding once the issue is completed & confirmed by you.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar
@RobinBlomberg RobinBlomberg added the feature request New feature or request label Oct 12, 2022
@RobinBlomberg
Copy link
Owner

RobinBlomberg commented Oct 12, 2022

This is an interesting idea. I would probably use pluralize for this.

I think, if this is implemented, we will sooner or later need a way to provide custom singularization rules as well. In that case, we might also need configuration capabilities as in #34.

@RobinBlomberg RobinBlomberg changed the title table/interface name transformer Add support for singularizing entities Oct 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants