Update quick-start example with updated auto generated files
This commit is contained in:
parent
fae8dde639
commit
616f27306e
8 changed files with 104 additions and 80 deletions
|
|
@ -11,7 +11,7 @@ import (
|
|||
"github.com/go-jet/jet/v2/postgres"
|
||||
)
|
||||
|
||||
var Actor = newActorTable()
|
||||
var Actor = newActorTable("dvds", "actor", "")
|
||||
|
||||
type actorTable struct {
|
||||
postgres.Table
|
||||
|
|
@ -33,20 +33,23 @@ type ActorTable struct {
|
|||
}
|
||||
|
||||
// AS creates new ActorTable with assigned alias
|
||||
func (a *ActorTable) AS(alias string) *ActorTable {
|
||||
aliasTable := newActorTable()
|
||||
aliasTable.Table.AS(alias)
|
||||
return aliasTable
|
||||
func (a ActorTable) AS(alias string) *ActorTable {
|
||||
return newActorTable(a.SchemaName(), a.TableName(), alias)
|
||||
}
|
||||
|
||||
func newActorTable() *ActorTable {
|
||||
// Schema creates new ActorTable with assigned schema name
|
||||
func (a ActorTable) FromSchema(schemaName string) *ActorTable {
|
||||
return newActorTable(schemaName, a.TableName(), a.Alias())
|
||||
}
|
||||
|
||||
func newActorTable(schemaName, tableName, alias string) *ActorTable {
|
||||
return &ActorTable{
|
||||
actorTable: newActorTableImpl("dvds", "actor"),
|
||||
EXCLUDED: newActorTableImpl("", "excluded"),
|
||||
actorTable: newActorTableImpl(schemaName, tableName, alias),
|
||||
EXCLUDED: newActorTableImpl("", "excluded", ""),
|
||||
}
|
||||
}
|
||||
|
||||
func newActorTableImpl(schemaName, tableName string) actorTable {
|
||||
func newActorTableImpl(schemaName, tableName, alias string) actorTable {
|
||||
var (
|
||||
ActorIDColumn = postgres.IntegerColumn("actor_id")
|
||||
FirstNameColumn = postgres.StringColumn("first_name")
|
||||
|
|
@ -57,7 +60,7 @@ func newActorTableImpl(schemaName, tableName string) actorTable {
|
|||
)
|
||||
|
||||
return actorTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, allColumns...),
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
ActorID: ActorIDColumn,
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import (
|
|||
"github.com/go-jet/jet/v2/postgres"
|
||||
)
|
||||
|
||||
var Category = newCategoryTable()
|
||||
var Category = newCategoryTable("dvds", "category", "")
|
||||
|
||||
type categoryTable struct {
|
||||
postgres.Table
|
||||
|
|
@ -32,20 +32,23 @@ type CategoryTable struct {
|
|||
}
|
||||
|
||||
// AS creates new CategoryTable with assigned alias
|
||||
func (a *CategoryTable) AS(alias string) *CategoryTable {
|
||||
aliasTable := newCategoryTable()
|
||||
aliasTable.Table.AS(alias)
|
||||
return aliasTable
|
||||
func (a CategoryTable) AS(alias string) *CategoryTable {
|
||||
return newCategoryTable(a.SchemaName(), a.TableName(), alias)
|
||||
}
|
||||
|
||||
func newCategoryTable() *CategoryTable {
|
||||
// Schema creates new CategoryTable with assigned schema name
|
||||
func (a CategoryTable) FromSchema(schemaName string) *CategoryTable {
|
||||
return newCategoryTable(schemaName, a.TableName(), a.Alias())
|
||||
}
|
||||
|
||||
func newCategoryTable(schemaName, tableName, alias string) *CategoryTable {
|
||||
return &CategoryTable{
|
||||
categoryTable: newCategoryTableImpl("dvds", "category"),
|
||||
EXCLUDED: newCategoryTableImpl("", "excluded"),
|
||||
categoryTable: newCategoryTableImpl(schemaName, tableName, alias),
|
||||
EXCLUDED: newCategoryTableImpl("", "excluded", ""),
|
||||
}
|
||||
}
|
||||
|
||||
func newCategoryTableImpl(schemaName, tableName string) categoryTable {
|
||||
func newCategoryTableImpl(schemaName, tableName, alias string) categoryTable {
|
||||
var (
|
||||
CategoryIDColumn = postgres.IntegerColumn("category_id")
|
||||
NameColumn = postgres.StringColumn("name")
|
||||
|
|
@ -55,7 +58,7 @@ func newCategoryTableImpl(schemaName, tableName string) categoryTable {
|
|||
)
|
||||
|
||||
return categoryTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, allColumns...),
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
CategoryID: CategoryIDColumn,
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import (
|
|||
"github.com/go-jet/jet/v2/postgres"
|
||||
)
|
||||
|
||||
var Film = newFilmTable()
|
||||
var Film = newFilmTable("dvds", "film", "")
|
||||
|
||||
type filmTable struct {
|
||||
postgres.Table
|
||||
|
|
@ -42,20 +42,23 @@ type FilmTable struct {
|
|||
}
|
||||
|
||||
// AS creates new FilmTable with assigned alias
|
||||
func (a *FilmTable) AS(alias string) *FilmTable {
|
||||
aliasTable := newFilmTable()
|
||||
aliasTable.Table.AS(alias)
|
||||
return aliasTable
|
||||
func (a FilmTable) AS(alias string) *FilmTable {
|
||||
return newFilmTable(a.SchemaName(), a.TableName(), alias)
|
||||
}
|
||||
|
||||
func newFilmTable() *FilmTable {
|
||||
// Schema creates new FilmTable with assigned schema name
|
||||
func (a FilmTable) FromSchema(schemaName string) *FilmTable {
|
||||
return newFilmTable(schemaName, a.TableName(), a.Alias())
|
||||
}
|
||||
|
||||
func newFilmTable(schemaName, tableName, alias string) *FilmTable {
|
||||
return &FilmTable{
|
||||
filmTable: newFilmTableImpl("dvds", "film"),
|
||||
EXCLUDED: newFilmTableImpl("", "excluded"),
|
||||
filmTable: newFilmTableImpl(schemaName, tableName, alias),
|
||||
EXCLUDED: newFilmTableImpl("", "excluded", ""),
|
||||
}
|
||||
}
|
||||
|
||||
func newFilmTableImpl(schemaName, tableName string) filmTable {
|
||||
func newFilmTableImpl(schemaName, tableName, alias string) filmTable {
|
||||
var (
|
||||
FilmIDColumn = postgres.IntegerColumn("film_id")
|
||||
TitleColumn = postgres.StringColumn("title")
|
||||
|
|
@ -75,7 +78,7 @@ func newFilmTableImpl(schemaName, tableName string) filmTable {
|
|||
)
|
||||
|
||||
return filmTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, allColumns...),
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
FilmID: FilmIDColumn,
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import (
|
|||
"github.com/go-jet/jet/v2/postgres"
|
||||
)
|
||||
|
||||
var FilmActor = newFilmActorTable()
|
||||
var FilmActor = newFilmActorTable("dvds", "film_actor", "")
|
||||
|
||||
type filmActorTable struct {
|
||||
postgres.Table
|
||||
|
|
@ -32,20 +32,23 @@ type FilmActorTable struct {
|
|||
}
|
||||
|
||||
// AS creates new FilmActorTable with assigned alias
|
||||
func (a *FilmActorTable) AS(alias string) *FilmActorTable {
|
||||
aliasTable := newFilmActorTable()
|
||||
aliasTable.Table.AS(alias)
|
||||
return aliasTable
|
||||
func (a FilmActorTable) AS(alias string) *FilmActorTable {
|
||||
return newFilmActorTable(a.SchemaName(), a.TableName(), alias)
|
||||
}
|
||||
|
||||
func newFilmActorTable() *FilmActorTable {
|
||||
// Schema creates new FilmActorTable with assigned schema name
|
||||
func (a FilmActorTable) FromSchema(schemaName string) *FilmActorTable {
|
||||
return newFilmActorTable(schemaName, a.TableName(), a.Alias())
|
||||
}
|
||||
|
||||
func newFilmActorTable(schemaName, tableName, alias string) *FilmActorTable {
|
||||
return &FilmActorTable{
|
||||
filmActorTable: newFilmActorTableImpl("dvds", "film_actor"),
|
||||
EXCLUDED: newFilmActorTableImpl("", "excluded"),
|
||||
filmActorTable: newFilmActorTableImpl(schemaName, tableName, alias),
|
||||
EXCLUDED: newFilmActorTableImpl("", "excluded", ""),
|
||||
}
|
||||
}
|
||||
|
||||
func newFilmActorTableImpl(schemaName, tableName string) filmActorTable {
|
||||
func newFilmActorTableImpl(schemaName, tableName, alias string) filmActorTable {
|
||||
var (
|
||||
ActorIDColumn = postgres.IntegerColumn("actor_id")
|
||||
FilmIDColumn = postgres.IntegerColumn("film_id")
|
||||
|
|
@ -55,7 +58,7 @@ func newFilmActorTableImpl(schemaName, tableName string) filmActorTable {
|
|||
)
|
||||
|
||||
return filmActorTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, allColumns...),
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
ActorID: ActorIDColumn,
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import (
|
|||
"github.com/go-jet/jet/v2/postgres"
|
||||
)
|
||||
|
||||
var FilmCategory = newFilmCategoryTable()
|
||||
var FilmCategory = newFilmCategoryTable("dvds", "film_category", "")
|
||||
|
||||
type filmCategoryTable struct {
|
||||
postgres.Table
|
||||
|
|
@ -32,20 +32,23 @@ type FilmCategoryTable struct {
|
|||
}
|
||||
|
||||
// AS creates new FilmCategoryTable with assigned alias
|
||||
func (a *FilmCategoryTable) AS(alias string) *FilmCategoryTable {
|
||||
aliasTable := newFilmCategoryTable()
|
||||
aliasTable.Table.AS(alias)
|
||||
return aliasTable
|
||||
func (a FilmCategoryTable) AS(alias string) *FilmCategoryTable {
|
||||
return newFilmCategoryTable(a.SchemaName(), a.TableName(), alias)
|
||||
}
|
||||
|
||||
func newFilmCategoryTable() *FilmCategoryTable {
|
||||
// Schema creates new FilmCategoryTable with assigned schema name
|
||||
func (a FilmCategoryTable) FromSchema(schemaName string) *FilmCategoryTable {
|
||||
return newFilmCategoryTable(schemaName, a.TableName(), a.Alias())
|
||||
}
|
||||
|
||||
func newFilmCategoryTable(schemaName, tableName, alias string) *FilmCategoryTable {
|
||||
return &FilmCategoryTable{
|
||||
filmCategoryTable: newFilmCategoryTableImpl("dvds", "film_category"),
|
||||
EXCLUDED: newFilmCategoryTableImpl("", "excluded"),
|
||||
filmCategoryTable: newFilmCategoryTableImpl(schemaName, tableName, alias),
|
||||
EXCLUDED: newFilmCategoryTableImpl("", "excluded", ""),
|
||||
}
|
||||
}
|
||||
|
||||
func newFilmCategoryTableImpl(schemaName, tableName string) filmCategoryTable {
|
||||
func newFilmCategoryTableImpl(schemaName, tableName, alias string) filmCategoryTable {
|
||||
var (
|
||||
FilmIDColumn = postgres.IntegerColumn("film_id")
|
||||
CategoryIDColumn = postgres.IntegerColumn("category_id")
|
||||
|
|
@ -55,7 +58,7 @@ func newFilmCategoryTableImpl(schemaName, tableName string) filmCategoryTable {
|
|||
)
|
||||
|
||||
return filmCategoryTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, allColumns...),
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
FilmID: FilmIDColumn,
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import (
|
|||
"github.com/go-jet/jet/v2/postgres"
|
||||
)
|
||||
|
||||
var Language = newLanguageTable()
|
||||
var Language = newLanguageTable("dvds", "language", "")
|
||||
|
||||
type languageTable struct {
|
||||
postgres.Table
|
||||
|
|
@ -32,20 +32,23 @@ type LanguageTable struct {
|
|||
}
|
||||
|
||||
// AS creates new LanguageTable with assigned alias
|
||||
func (a *LanguageTable) AS(alias string) *LanguageTable {
|
||||
aliasTable := newLanguageTable()
|
||||
aliasTable.Table.AS(alias)
|
||||
return aliasTable
|
||||
func (a LanguageTable) AS(alias string) *LanguageTable {
|
||||
return newLanguageTable(a.SchemaName(), a.TableName(), alias)
|
||||
}
|
||||
|
||||
func newLanguageTable() *LanguageTable {
|
||||
// Schema creates new LanguageTable with assigned schema name
|
||||
func (a LanguageTable) FromSchema(schemaName string) *LanguageTable {
|
||||
return newLanguageTable(schemaName, a.TableName(), a.Alias())
|
||||
}
|
||||
|
||||
func newLanguageTable(schemaName, tableName, alias string) *LanguageTable {
|
||||
return &LanguageTable{
|
||||
languageTable: newLanguageTableImpl("dvds", "language"),
|
||||
EXCLUDED: newLanguageTableImpl("", "excluded"),
|
||||
languageTable: newLanguageTableImpl(schemaName, tableName, alias),
|
||||
EXCLUDED: newLanguageTableImpl("", "excluded", ""),
|
||||
}
|
||||
}
|
||||
|
||||
func newLanguageTableImpl(schemaName, tableName string) languageTable {
|
||||
func newLanguageTableImpl(schemaName, tableName, alias string) languageTable {
|
||||
var (
|
||||
LanguageIDColumn = postgres.IntegerColumn("language_id")
|
||||
NameColumn = postgres.StringColumn("name")
|
||||
|
|
@ -55,7 +58,7 @@ func newLanguageTableImpl(schemaName, tableName string) languageTable {
|
|||
)
|
||||
|
||||
return languageTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, allColumns...),
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
LanguageID: LanguageIDColumn,
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import (
|
|||
"github.com/go-jet/jet/v2/postgres"
|
||||
)
|
||||
|
||||
var ActorInfo = newActorInfoTable()
|
||||
var ActorInfo = newActorInfoTable("dvds", "actor_info", "")
|
||||
|
||||
type actorInfoTable struct {
|
||||
postgres.Table
|
||||
|
|
@ -33,20 +33,23 @@ type ActorInfoTable struct {
|
|||
}
|
||||
|
||||
// AS creates new ActorInfoTable with assigned alias
|
||||
func (a *ActorInfoTable) AS(alias string) *ActorInfoTable {
|
||||
aliasTable := newActorInfoTable()
|
||||
aliasTable.Table.AS(alias)
|
||||
return aliasTable
|
||||
func (a ActorInfoTable) AS(alias string) *ActorInfoTable {
|
||||
return newActorInfoTable(a.SchemaName(), a.TableName(), alias)
|
||||
}
|
||||
|
||||
func newActorInfoTable() *ActorInfoTable {
|
||||
// Schema creates new ActorInfoTable with assigned schema name
|
||||
func (a ActorInfoTable) FromSchema(schemaName string) *ActorInfoTable {
|
||||
return newActorInfoTable(schemaName, a.TableName(), a.Alias())
|
||||
}
|
||||
|
||||
func newActorInfoTable(schemaName, tableName, alias string) *ActorInfoTable {
|
||||
return &ActorInfoTable{
|
||||
actorInfoTable: newActorInfoTableImpl("dvds", "actor_info"),
|
||||
EXCLUDED: newActorInfoTableImpl("", "excluded"),
|
||||
actorInfoTable: newActorInfoTableImpl(schemaName, tableName, alias),
|
||||
EXCLUDED: newActorInfoTableImpl("", "excluded", ""),
|
||||
}
|
||||
}
|
||||
|
||||
func newActorInfoTableImpl(schemaName, tableName string) actorInfoTable {
|
||||
func newActorInfoTableImpl(schemaName, tableName, alias string) actorInfoTable {
|
||||
var (
|
||||
ActorIDColumn = postgres.IntegerColumn("actor_id")
|
||||
FirstNameColumn = postgres.StringColumn("first_name")
|
||||
|
|
@ -57,7 +60,7 @@ func newActorInfoTableImpl(schemaName, tableName string) actorInfoTable {
|
|||
)
|
||||
|
||||
return actorInfoTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, allColumns...),
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
ActorID: ActorIDColumn,
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import (
|
|||
"github.com/go-jet/jet/v2/postgres"
|
||||
)
|
||||
|
||||
var CustomerList = newCustomerListTable()
|
||||
var CustomerList = newCustomerListTable("dvds", "customer_list", "")
|
||||
|
||||
type customerListTable struct {
|
||||
postgres.Table
|
||||
|
|
@ -38,20 +38,23 @@ type CustomerListTable struct {
|
|||
}
|
||||
|
||||
// AS creates new CustomerListTable with assigned alias
|
||||
func (a *CustomerListTable) AS(alias string) *CustomerListTable {
|
||||
aliasTable := newCustomerListTable()
|
||||
aliasTable.Table.AS(alias)
|
||||
return aliasTable
|
||||
func (a CustomerListTable) AS(alias string) *CustomerListTable {
|
||||
return newCustomerListTable(a.SchemaName(), a.TableName(), alias)
|
||||
}
|
||||
|
||||
func newCustomerListTable() *CustomerListTable {
|
||||
// Schema creates new CustomerListTable with assigned schema name
|
||||
func (a CustomerListTable) FromSchema(schemaName string) *CustomerListTable {
|
||||
return newCustomerListTable(schemaName, a.TableName(), a.Alias())
|
||||
}
|
||||
|
||||
func newCustomerListTable(schemaName, tableName, alias string) *CustomerListTable {
|
||||
return &CustomerListTable{
|
||||
customerListTable: newCustomerListTableImpl("dvds", "customer_list"),
|
||||
EXCLUDED: newCustomerListTableImpl("", "excluded"),
|
||||
customerListTable: newCustomerListTableImpl(schemaName, tableName, alias),
|
||||
EXCLUDED: newCustomerListTableImpl("", "excluded", ""),
|
||||
}
|
||||
}
|
||||
|
||||
func newCustomerListTableImpl(schemaName, tableName string) customerListTable {
|
||||
func newCustomerListTableImpl(schemaName, tableName, alias string) customerListTable {
|
||||
var (
|
||||
IDColumn = postgres.IntegerColumn("id")
|
||||
NameColumn = postgres.StringColumn("name")
|
||||
|
|
@ -67,7 +70,7 @@ func newCustomerListTableImpl(schemaName, tableName string) customerListTable {
|
|||
)
|
||||
|
||||
return customerListTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, allColumns...),
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
ID: IDColumn,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue