Skip to content

Commit 3f65e45

Browse files
authored
Merge pull request #339 from Nitjsefni7/feature/allow-retrieve-alias-field-from-view
Allowing to retrieve alias field from the View structure
2 parents 91f9bef + 09ce6a8 commit 3f65e45

File tree

4 files changed

+13
-0
lines changed

4 files changed

+13
-0
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1414
- Added a `QueryTemplate` field to `bobgen_helpers.Templates` for drivers to include additional templates for queries.
1515
- Added a new reserved output key `queries`. This is handled specially for each query folder supplied by the driver.
1616
- Added new `wm` package to each dialect for mods that modify `Window` clauses.
17+
- Added a new method `Alias` for `View` struct, for each dialect. It returns the alias of the view.
1718

1819
### Changed
1920

dialect/mysql/view.go

+4
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ func (v *View[T, Tslice]) NameAs() bob.Expression {
5656
return v.Name().As(v.alias)
5757
}
5858

59+
func (v *View[T, Tslice]) Alias() string {
60+
return v.alias
61+
}
62+
5963
// Returns a column list
6064
func (v *View[T, Tslice]) Columns() orm.Columns {
6165
// get the schema

dialect/psql/view.go

+4
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ func (v *View[T, Tslice]) NameAs() bob.Expression {
7474
return v.Name().As(v.alias)
7575
}
7676

77+
func (v *View[T, Tslice]) Alias() string {
78+
return v.alias
79+
}
80+
7781
// Returns a column list
7882
func (v *View[T, Tslice]) Columns() orm.Columns {
7983
// get the schema

dialect/sqlite/view.go

+4
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ func (v *View[T, Tslice]) NameAs() bob.Expression {
7474
return v.Name().As(v.alias)
7575
}
7676

77+
func (v *View[T, Tslice]) Alias() string {
78+
return v.alias
79+
}
80+
7781
// Returns a column list
7882
func (v *View[T, Tslice]) Columns() orm.Columns {
7983
// get the schema

0 commit comments

Comments
 (0)