Skip to content

Commit

Permalink
Merge pull request #339 from Nitjsefni7/feature/allow-retrieve-alias-…
Browse files Browse the repository at this point in the history
…field-from-view

Allowing to retrieve alias field from the View structure
  • Loading branch information
stephenafamo authored Jan 11, 2025
2 parents 91f9bef + 09ce6a8 commit 3f65e45
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
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

0 comments on commit 3f65e45

Please sign in to comment.