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

Allowing to retrieve alias field from the View structure #333

Open
Nitjsefni7 opened this issue Jan 2, 2025 · 2 comments
Open

Allowing to retrieve alias field from the View structure #333

Nitjsefni7 opened this issue Jan 2, 2025 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@Nitjsefni7
Copy link

In our project, we could benefit from the possibility of retrieving the alias field from the View structure.

The simple method like
func (v *View[T, Tslice]) Alias() string { return v.alias }
would do the trick.

If you approve the proposition, I will be eager to create a pull request.

@stephenafamo
Copy link
Owner

This seems like a straightforward addition.

Can you share what situation you've encountered where you need this?

@stephenafamo stephenafamo added enhancement New feature or request good first issue Good for newcomers labels Jan 3, 2025
@Nitjsefni7
Copy link
Author

When using nested queries in FROM clause, in order to be able to rely on column names provided by bob's models (aliased by default with "schema.table_name") we have to provide the alias to As() method for the nested query. If the Alias() method is provided, we will be able to alias nested queries automatically, based on the table used in the FROM clause of the nested query.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants