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 #339

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added a `QueryTemplate` field to `bobgen_helpers.Templates` for drivers to include additional templates for queries.
- Added a new reserved output key `queries`. This is handled specially for each query folder supplied by the driver.
- Added new `wm` package to each dialect for mods that modify `Window` clauses.
- Added a new method `Alias` for `View` struct, for each dialect. It returns the alias of the view.

### Changed

Expand Down
4 changes: 4 additions & 0 deletions dialect/mysql/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ func (v *View[T, Tslice]) NameAs() bob.Expression {
return v.Name().As(v.alias)
}

func (v *View[T, Tslice]) Alias() string {
return v.alias
}

// Returns a column list
func (v *View[T, Tslice]) Columns() orm.Columns {
// get the schema
Expand Down
4 changes: 4 additions & 0 deletions dialect/psql/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ func (v *View[T, Tslice]) NameAs() bob.Expression {
return v.Name().As(v.alias)
}

func (v *View[T, Tslice]) Alias() string {
return v.alias
}

// Returns a column list
func (v *View[T, Tslice]) Columns() orm.Columns {
// get the schema
Expand Down
4 changes: 4 additions & 0 deletions dialect/sqlite/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ func (v *View[T, Tslice]) NameAs() bob.Expression {
return v.Name().As(v.alias)
}

func (v *View[T, Tslice]) Alias() string {
return v.alias
}

// Returns a column list
func (v *View[T, Tslice]) Columns() orm.Columns {
// get the schema
Expand Down
Loading