Update quick start example.

This commit is contained in:
go-jet 2020-05-31 10:42:55 +02:00
parent 196989ab68
commit 0183117b72
18 changed files with 184 additions and 96 deletions

View file

@ -1,6 +1,5 @@
// //
// Code generated by go-jet DO NOT EDIT. // Code generated by go-jet DO NOT EDIT.
// Generated at Thursday, 26-Sep-19 12:02:13 CEST
// //
// WARNING: Changes to this file may cause incorrect behavior // WARNING: Changes to this file may cause incorrect behavior
// and will be lost if the code is regenerated // and will be lost if the code is regenerated

View file

@ -1,6 +1,5 @@
// //
// Code generated by go-jet DO NOT EDIT. // Code generated by go-jet DO NOT EDIT.
// Generated at Thursday, 26-Sep-19 12:02:13 CEST
// //
// WARNING: Changes to this file may cause incorrect behavior // WARNING: Changes to this file may cause incorrect behavior
// and will be lost if the code is regenerated // and will be lost if the code is regenerated

View file

@ -1,6 +1,5 @@
// //
// Code generated by go-jet DO NOT EDIT. // Code generated by go-jet DO NOT EDIT.
// Generated at Thursday, 26-Sep-19 12:02:13 CEST
// //
// WARNING: Changes to this file may cause incorrect behavior // WARNING: Changes to this file may cause incorrect behavior
// and will be lost if the code is regenerated // and will be lost if the code is regenerated

View file

@ -1,6 +1,5 @@
// //
// Code generated by go-jet DO NOT EDIT. // Code generated by go-jet DO NOT EDIT.
// Generated at Thursday, 26-Sep-19 12:02:13 CEST
// //
// WARNING: Changes to this file may cause incorrect behavior // WARNING: Changes to this file may cause incorrect behavior
// and will be lost if the code is regenerated // and will be lost if the code is regenerated

View file

@ -1,6 +1,5 @@
// //
// Code generated by go-jet DO NOT EDIT. // Code generated by go-jet DO NOT EDIT.
// Generated at Thursday, 26-Sep-19 12:02:13 CEST
// //
// WARNING: Changes to this file may cause incorrect behavior // WARNING: Changes to this file may cause incorrect behavior
// and will be lost if the code is regenerated // and will be lost if the code is regenerated

View file

@ -1,6 +1,5 @@
// //
// Code generated by go-jet DO NOT EDIT. // Code generated by go-jet DO NOT EDIT.
// Generated at Thursday, 26-Sep-19 12:02:13 CEST
// //
// WARNING: Changes to this file may cause incorrect behavior // WARNING: Changes to this file may cause incorrect behavior
// and will be lost if the code is regenerated // and will be lost if the code is regenerated

View file

@ -1,6 +1,5 @@
// //
// Code generated by go-jet DO NOT EDIT. // Code generated by go-jet DO NOT EDIT.
// Generated at Thursday, 26-Sep-19 12:02:13 CEST
// //
// WARNING: Changes to this file may cause incorrect behavior // WARNING: Changes to this file may cause incorrect behavior
// and will be lost if the code is regenerated // and will be lost if the code is regenerated

View file

@ -1,6 +1,5 @@
// //
// Code generated by go-jet DO NOT EDIT. // Code generated by go-jet DO NOT EDIT.
// Generated at Thursday, 26-Sep-19 12:02:13 CEST
// //
// WARNING: Changes to this file may cause incorrect behavior // WARNING: Changes to this file may cause incorrect behavior
// and will be lost if the code is regenerated // and will be lost if the code is regenerated

View file

@ -1,6 +1,5 @@
// //
// Code generated by go-jet DO NOT EDIT. // Code generated by go-jet DO NOT EDIT.
// Generated at Thursday, 26-Sep-19 12:02:13 CEST
// //
// WARNING: Changes to this file may cause incorrect behavior // WARNING: Changes to this file may cause incorrect behavior
// and will be lost if the code is regenerated // and will be lost if the code is regenerated
@ -14,7 +13,7 @@ import (
var Actor = newActorTable() var Actor = newActorTable()
type ActorTable struct { type actorTable struct {
postgres.Table postgres.Table
//Columns //Columns
@ -27,25 +26,38 @@ type ActorTable struct {
MutableColumns postgres.ColumnList MutableColumns postgres.ColumnList
} }
// creates new ActorTable with assigned alias type ActorTable struct {
actorTable
EXCLUDED actorTable
}
// AS creates new ActorTable with assigned alias
func (a *ActorTable) AS(alias string) *ActorTable { func (a *ActorTable) AS(alias string) *ActorTable {
aliasTable := newActorTable() aliasTable := newActorTable()
aliasTable.Table.AS(alias) aliasTable.Table.AS(alias)
return aliasTable return aliasTable
} }
func newActorTable() *ActorTable { func newActorTable() *ActorTable {
return &ActorTable{
actorTable: newActorTableImpl("dvds", "actor"),
EXCLUDED: newActorTableImpl("", "excluded"),
}
}
func newActorTableImpl(schemaName, tableName string) actorTable {
var ( var (
ActorIDColumn = postgres.IntegerColumn("actor_id") ActorIDColumn = postgres.IntegerColumn("actor_id")
FirstNameColumn = postgres.StringColumn("first_name") FirstNameColumn = postgres.StringColumn("first_name")
LastNameColumn = postgres.StringColumn("last_name") LastNameColumn = postgres.StringColumn("last_name")
LastUpdateColumn = postgres.TimestampColumn("last_update") LastUpdateColumn = postgres.TimestampColumn("last_update")
allColumns = postgres.ColumnList{ActorIDColumn, FirstNameColumn, LastNameColumn, LastUpdateColumn}
mutableColumns = postgres.ColumnList{FirstNameColumn, LastNameColumn, LastUpdateColumn}
) )
return &ActorTable{ return actorTable{
Table: postgres.NewTable("dvds", "actor", ActorIDColumn, FirstNameColumn, LastNameColumn, LastUpdateColumn), Table: postgres.NewTable(schemaName, tableName, allColumns...),
//Columns //Columns
ActorID: ActorIDColumn, ActorID: ActorIDColumn,
@ -53,7 +65,7 @@ func newActorTable() *ActorTable {
LastName: LastNameColumn, LastName: LastNameColumn,
LastUpdate: LastUpdateColumn, LastUpdate: LastUpdateColumn,
AllColumns: postgres.ColumnList{ActorIDColumn, FirstNameColumn, LastNameColumn, LastUpdateColumn}, AllColumns: allColumns,
MutableColumns: postgres.ColumnList{FirstNameColumn, LastNameColumn, LastUpdateColumn}, MutableColumns: mutableColumns,
} }
} }

View file

@ -1,6 +1,5 @@
// //
// Code generated by go-jet DO NOT EDIT. // Code generated by go-jet DO NOT EDIT.
// Generated at Thursday, 26-Sep-19 12:02:13 CEST
// //
// WARNING: Changes to this file may cause incorrect behavior // WARNING: Changes to this file may cause incorrect behavior
// and will be lost if the code is regenerated // and will be lost if the code is regenerated
@ -14,7 +13,7 @@ import (
var Category = newCategoryTable() var Category = newCategoryTable()
type CategoryTable struct { type categoryTable struct {
postgres.Table postgres.Table
//Columns //Columns
@ -26,31 +25,44 @@ type CategoryTable struct {
MutableColumns postgres.ColumnList MutableColumns postgres.ColumnList
} }
// creates new CategoryTable with assigned alias type CategoryTable struct {
categoryTable
EXCLUDED categoryTable
}
// AS creates new CategoryTable with assigned alias
func (a *CategoryTable) AS(alias string) *CategoryTable { func (a *CategoryTable) AS(alias string) *CategoryTable {
aliasTable := newCategoryTable() aliasTable := newCategoryTable()
aliasTable.Table.AS(alias) aliasTable.Table.AS(alias)
return aliasTable return aliasTable
} }
func newCategoryTable() *CategoryTable { func newCategoryTable() *CategoryTable {
return &CategoryTable{
categoryTable: newCategoryTableImpl("dvds", "category"),
EXCLUDED: newCategoryTableImpl("", "excluded"),
}
}
func newCategoryTableImpl(schemaName, tableName string) categoryTable {
var ( var (
CategoryIDColumn = postgres.IntegerColumn("category_id") CategoryIDColumn = postgres.IntegerColumn("category_id")
NameColumn = postgres.StringColumn("name") NameColumn = postgres.StringColumn("name")
LastUpdateColumn = postgres.TimestampColumn("last_update") LastUpdateColumn = postgres.TimestampColumn("last_update")
allColumns = postgres.ColumnList{CategoryIDColumn, NameColumn, LastUpdateColumn}
mutableColumns = postgres.ColumnList{NameColumn, LastUpdateColumn}
) )
return &CategoryTable{ return categoryTable{
Table: postgres.NewTable("dvds", "category", CategoryIDColumn, NameColumn, LastUpdateColumn), Table: postgres.NewTable(schemaName, tableName, allColumns...),
//Columns //Columns
CategoryID: CategoryIDColumn, CategoryID: CategoryIDColumn,
Name: NameColumn, Name: NameColumn,
LastUpdate: LastUpdateColumn, LastUpdate: LastUpdateColumn,
AllColumns: postgres.ColumnList{CategoryIDColumn, NameColumn, LastUpdateColumn}, AllColumns: allColumns,
MutableColumns: postgres.ColumnList{NameColumn, LastUpdateColumn}, MutableColumns: mutableColumns,
} }
} }

View file

@ -1,6 +1,5 @@
// //
// Code generated by go-jet DO NOT EDIT. // Code generated by go-jet DO NOT EDIT.
// Generated at Thursday, 26-Sep-19 12:02:13 CEST
// //
// WARNING: Changes to this file may cause incorrect behavior // WARNING: Changes to this file may cause incorrect behavior
// and will be lost if the code is regenerated // and will be lost if the code is regenerated
@ -14,7 +13,7 @@ import (
var Film = newFilmTable() var Film = newFilmTable()
type FilmTable struct { type filmTable struct {
postgres.Table postgres.Table
//Columns //Columns
@ -36,16 +35,27 @@ type FilmTable struct {
MutableColumns postgres.ColumnList MutableColumns postgres.ColumnList
} }
// creates new FilmTable with assigned alias type FilmTable struct {
filmTable
EXCLUDED filmTable
}
// AS creates new FilmTable with assigned alias
func (a *FilmTable) AS(alias string) *FilmTable { func (a *FilmTable) AS(alias string) *FilmTable {
aliasTable := newFilmTable() aliasTable := newFilmTable()
aliasTable.Table.AS(alias) aliasTable.Table.AS(alias)
return aliasTable return aliasTable
} }
func newFilmTable() *FilmTable { func newFilmTable() *FilmTable {
return &FilmTable{
filmTable: newFilmTableImpl("dvds", "film"),
EXCLUDED: newFilmTableImpl("", "excluded"),
}
}
func newFilmTableImpl(schemaName, tableName string) filmTable {
var ( var (
FilmIDColumn = postgres.IntegerColumn("film_id") FilmIDColumn = postgres.IntegerColumn("film_id")
TitleColumn = postgres.StringColumn("title") TitleColumn = postgres.StringColumn("title")
@ -60,10 +70,12 @@ func newFilmTable() *FilmTable {
LastUpdateColumn = postgres.TimestampColumn("last_update") LastUpdateColumn = postgres.TimestampColumn("last_update")
SpecialFeaturesColumn = postgres.StringColumn("special_features") SpecialFeaturesColumn = postgres.StringColumn("special_features")
FulltextColumn = postgres.StringColumn("fulltext") FulltextColumn = postgres.StringColumn("fulltext")
allColumns = postgres.ColumnList{FilmIDColumn, TitleColumn, DescriptionColumn, ReleaseYearColumn, LanguageIDColumn, RentalDurationColumn, RentalRateColumn, LengthColumn, ReplacementCostColumn, RatingColumn, LastUpdateColumn, SpecialFeaturesColumn, FulltextColumn}
mutableColumns = postgres.ColumnList{TitleColumn, DescriptionColumn, ReleaseYearColumn, LanguageIDColumn, RentalDurationColumn, RentalRateColumn, LengthColumn, ReplacementCostColumn, RatingColumn, LastUpdateColumn, SpecialFeaturesColumn, FulltextColumn}
) )
return &FilmTable{ return filmTable{
Table: postgres.NewTable("dvds", "film", FilmIDColumn, TitleColumn, DescriptionColumn, ReleaseYearColumn, LanguageIDColumn, RentalDurationColumn, RentalRateColumn, LengthColumn, ReplacementCostColumn, RatingColumn, LastUpdateColumn, SpecialFeaturesColumn, FulltextColumn), Table: postgres.NewTable(schemaName, tableName, allColumns...),
//Columns //Columns
FilmID: FilmIDColumn, FilmID: FilmIDColumn,
@ -80,7 +92,7 @@ func newFilmTable() *FilmTable {
SpecialFeatures: SpecialFeaturesColumn, SpecialFeatures: SpecialFeaturesColumn,
Fulltext: FulltextColumn, Fulltext: FulltextColumn,
AllColumns: postgres.ColumnList{FilmIDColumn, TitleColumn, DescriptionColumn, ReleaseYearColumn, LanguageIDColumn, RentalDurationColumn, RentalRateColumn, LengthColumn, ReplacementCostColumn, RatingColumn, LastUpdateColumn, SpecialFeaturesColumn, FulltextColumn}, AllColumns: allColumns,
MutableColumns: postgres.ColumnList{TitleColumn, DescriptionColumn, ReleaseYearColumn, LanguageIDColumn, RentalDurationColumn, RentalRateColumn, LengthColumn, ReplacementCostColumn, RatingColumn, LastUpdateColumn, SpecialFeaturesColumn, FulltextColumn}, MutableColumns: mutableColumns,
} }
} }

View file

@ -1,6 +1,5 @@
// //
// Code generated by go-jet DO NOT EDIT. // Code generated by go-jet DO NOT EDIT.
// Generated at Thursday, 26-Sep-19 12:02:13 CEST
// //
// WARNING: Changes to this file may cause incorrect behavior // WARNING: Changes to this file may cause incorrect behavior
// and will be lost if the code is regenerated // and will be lost if the code is regenerated
@ -14,7 +13,7 @@ import (
var FilmActor = newFilmActorTable() var FilmActor = newFilmActorTable()
type FilmActorTable struct { type filmActorTable struct {
postgres.Table postgres.Table
//Columns //Columns
@ -26,31 +25,44 @@ type FilmActorTable struct {
MutableColumns postgres.ColumnList MutableColumns postgres.ColumnList
} }
// creates new FilmActorTable with assigned alias type FilmActorTable struct {
filmActorTable
EXCLUDED filmActorTable
}
// AS creates new FilmActorTable with assigned alias
func (a *FilmActorTable) AS(alias string) *FilmActorTable { func (a *FilmActorTable) AS(alias string) *FilmActorTable {
aliasTable := newFilmActorTable() aliasTable := newFilmActorTable()
aliasTable.Table.AS(alias) aliasTable.Table.AS(alias)
return aliasTable return aliasTable
} }
func newFilmActorTable() *FilmActorTable { func newFilmActorTable() *FilmActorTable {
return &FilmActorTable{
filmActorTable: newFilmActorTableImpl("dvds", "film_actor"),
EXCLUDED: newFilmActorTableImpl("", "excluded"),
}
}
func newFilmActorTableImpl(schemaName, tableName string) filmActorTable {
var ( var (
ActorIDColumn = postgres.IntegerColumn("actor_id") ActorIDColumn = postgres.IntegerColumn("actor_id")
FilmIDColumn = postgres.IntegerColumn("film_id") FilmIDColumn = postgres.IntegerColumn("film_id")
LastUpdateColumn = postgres.TimestampColumn("last_update") LastUpdateColumn = postgres.TimestampColumn("last_update")
allColumns = postgres.ColumnList{ActorIDColumn, FilmIDColumn, LastUpdateColumn}
mutableColumns = postgres.ColumnList{LastUpdateColumn}
) )
return &FilmActorTable{ return filmActorTable{
Table: postgres.NewTable("dvds", "film_actor", ActorIDColumn, FilmIDColumn, LastUpdateColumn), Table: postgres.NewTable(schemaName, tableName, allColumns...),
//Columns //Columns
ActorID: ActorIDColumn, ActorID: ActorIDColumn,
FilmID: FilmIDColumn, FilmID: FilmIDColumn,
LastUpdate: LastUpdateColumn, LastUpdate: LastUpdateColumn,
AllColumns: postgres.ColumnList{ActorIDColumn, FilmIDColumn, LastUpdateColumn}, AllColumns: allColumns,
MutableColumns: postgres.ColumnList{LastUpdateColumn}, MutableColumns: mutableColumns,
} }
} }

View file

@ -1,6 +1,5 @@
// //
// Code generated by go-jet DO NOT EDIT. // Code generated by go-jet DO NOT EDIT.
// Generated at Thursday, 26-Sep-19 12:02:13 CEST
// //
// WARNING: Changes to this file may cause incorrect behavior // WARNING: Changes to this file may cause incorrect behavior
// and will be lost if the code is regenerated // and will be lost if the code is regenerated
@ -14,7 +13,7 @@ import (
var FilmCategory = newFilmCategoryTable() var FilmCategory = newFilmCategoryTable()
type FilmCategoryTable struct { type filmCategoryTable struct {
postgres.Table postgres.Table
//Columns //Columns
@ -26,31 +25,44 @@ type FilmCategoryTable struct {
MutableColumns postgres.ColumnList MutableColumns postgres.ColumnList
} }
// creates new FilmCategoryTable with assigned alias type FilmCategoryTable struct {
filmCategoryTable
EXCLUDED filmCategoryTable
}
// AS creates new FilmCategoryTable with assigned alias
func (a *FilmCategoryTable) AS(alias string) *FilmCategoryTable { func (a *FilmCategoryTable) AS(alias string) *FilmCategoryTable {
aliasTable := newFilmCategoryTable() aliasTable := newFilmCategoryTable()
aliasTable.Table.AS(alias) aliasTable.Table.AS(alias)
return aliasTable return aliasTable
} }
func newFilmCategoryTable() *FilmCategoryTable { func newFilmCategoryTable() *FilmCategoryTable {
return &FilmCategoryTable{
filmCategoryTable: newFilmCategoryTableImpl("dvds", "film_category"),
EXCLUDED: newFilmCategoryTableImpl("", "excluded"),
}
}
func newFilmCategoryTableImpl(schemaName, tableName string) filmCategoryTable {
var ( var (
FilmIDColumn = postgres.IntegerColumn("film_id") FilmIDColumn = postgres.IntegerColumn("film_id")
CategoryIDColumn = postgres.IntegerColumn("category_id") CategoryIDColumn = postgres.IntegerColumn("category_id")
LastUpdateColumn = postgres.TimestampColumn("last_update") LastUpdateColumn = postgres.TimestampColumn("last_update")
allColumns = postgres.ColumnList{FilmIDColumn, CategoryIDColumn, LastUpdateColumn}
mutableColumns = postgres.ColumnList{LastUpdateColumn}
) )
return &FilmCategoryTable{ return filmCategoryTable{
Table: postgres.NewTable("dvds", "film_category", FilmIDColumn, CategoryIDColumn, LastUpdateColumn), Table: postgres.NewTable(schemaName, tableName, allColumns...),
//Columns //Columns
FilmID: FilmIDColumn, FilmID: FilmIDColumn,
CategoryID: CategoryIDColumn, CategoryID: CategoryIDColumn,
LastUpdate: LastUpdateColumn, LastUpdate: LastUpdateColumn,
AllColumns: postgres.ColumnList{FilmIDColumn, CategoryIDColumn, LastUpdateColumn}, AllColumns: allColumns,
MutableColumns: postgres.ColumnList{LastUpdateColumn}, MutableColumns: mutableColumns,
} }
} }

View file

@ -1,6 +1,5 @@
// //
// Code generated by go-jet DO NOT EDIT. // Code generated by go-jet DO NOT EDIT.
// Generated at Thursday, 26-Sep-19 12:02:13 CEST
// //
// WARNING: Changes to this file may cause incorrect behavior // WARNING: Changes to this file may cause incorrect behavior
// and will be lost if the code is regenerated // and will be lost if the code is regenerated
@ -14,7 +13,7 @@ import (
var Language = newLanguageTable() var Language = newLanguageTable()
type LanguageTable struct { type languageTable struct {
postgres.Table postgres.Table
//Columns //Columns
@ -26,31 +25,44 @@ type LanguageTable struct {
MutableColumns postgres.ColumnList MutableColumns postgres.ColumnList
} }
// creates new LanguageTable with assigned alias type LanguageTable struct {
languageTable
EXCLUDED languageTable
}
// AS creates new LanguageTable with assigned alias
func (a *LanguageTable) AS(alias string) *LanguageTable { func (a *LanguageTable) AS(alias string) *LanguageTable {
aliasTable := newLanguageTable() aliasTable := newLanguageTable()
aliasTable.Table.AS(alias) aliasTable.Table.AS(alias)
return aliasTable return aliasTable
} }
func newLanguageTable() *LanguageTable { func newLanguageTable() *LanguageTable {
return &LanguageTable{
languageTable: newLanguageTableImpl("dvds", "language"),
EXCLUDED: newLanguageTableImpl("", "excluded"),
}
}
func newLanguageTableImpl(schemaName, tableName string) languageTable {
var ( var (
LanguageIDColumn = postgres.IntegerColumn("language_id") LanguageIDColumn = postgres.IntegerColumn("language_id")
NameColumn = postgres.StringColumn("name") NameColumn = postgres.StringColumn("name")
LastUpdateColumn = postgres.TimestampColumn("last_update") LastUpdateColumn = postgres.TimestampColumn("last_update")
allColumns = postgres.ColumnList{LanguageIDColumn, NameColumn, LastUpdateColumn}
mutableColumns = postgres.ColumnList{NameColumn, LastUpdateColumn}
) )
return &LanguageTable{ return languageTable{
Table: postgres.NewTable("dvds", "language", LanguageIDColumn, NameColumn, LastUpdateColumn), Table: postgres.NewTable(schemaName, tableName, allColumns...),
//Columns //Columns
LanguageID: LanguageIDColumn, LanguageID: LanguageIDColumn,
Name: NameColumn, Name: NameColumn,
LastUpdate: LastUpdateColumn, LastUpdate: LastUpdateColumn,
AllColumns: postgres.ColumnList{LanguageIDColumn, NameColumn, LastUpdateColumn}, AllColumns: allColumns,
MutableColumns: postgres.ColumnList{NameColumn, LastUpdateColumn}, MutableColumns: mutableColumns,
} }
} }

View file

@ -1,6 +1,5 @@
// //
// Code generated by go-jet DO NOT EDIT. // Code generated by go-jet DO NOT EDIT.
// Generated at Thursday, 26-Sep-19 12:02:13 CEST
// //
// WARNING: Changes to this file may cause incorrect behavior // WARNING: Changes to this file may cause incorrect behavior
// and will be lost if the code is regenerated // and will be lost if the code is regenerated
@ -14,7 +13,7 @@ import (
var ActorInfo = newActorInfoTable() var ActorInfo = newActorInfoTable()
type ActorInfoTable struct { type actorInfoTable struct {
postgres.Table postgres.Table
//Columns //Columns
@ -27,25 +26,38 @@ type ActorInfoTable struct {
MutableColumns postgres.ColumnList MutableColumns postgres.ColumnList
} }
// creates new ActorInfoTable with assigned alias type ActorInfoTable struct {
actorInfoTable
EXCLUDED actorInfoTable
}
// AS creates new ActorInfoTable with assigned alias
func (a *ActorInfoTable) AS(alias string) *ActorInfoTable { func (a *ActorInfoTable) AS(alias string) *ActorInfoTable {
aliasTable := newActorInfoTable() aliasTable := newActorInfoTable()
aliasTable.Table.AS(alias) aliasTable.Table.AS(alias)
return aliasTable return aliasTable
} }
func newActorInfoTable() *ActorInfoTable { func newActorInfoTable() *ActorInfoTable {
return &ActorInfoTable{
actorInfoTable: newActorInfoTableImpl("dvds", "actor_info"),
EXCLUDED: newActorInfoTableImpl("", "excluded"),
}
}
func newActorInfoTableImpl(schemaName, tableName string) actorInfoTable {
var ( var (
ActorIDColumn = postgres.IntegerColumn("actor_id") ActorIDColumn = postgres.IntegerColumn("actor_id")
FirstNameColumn = postgres.StringColumn("first_name") FirstNameColumn = postgres.StringColumn("first_name")
LastNameColumn = postgres.StringColumn("last_name") LastNameColumn = postgres.StringColumn("last_name")
FilmInfoColumn = postgres.StringColumn("film_info") FilmInfoColumn = postgres.StringColumn("film_info")
allColumns = postgres.ColumnList{ActorIDColumn, FirstNameColumn, LastNameColumn, FilmInfoColumn}
mutableColumns = postgres.ColumnList{ActorIDColumn, FirstNameColumn, LastNameColumn, FilmInfoColumn}
) )
return &ActorInfoTable{ return actorInfoTable{
Table: postgres.NewTable("dvds", "actor_info", ActorIDColumn, FirstNameColumn, LastNameColumn, FilmInfoColumn), Table: postgres.NewTable(schemaName, tableName, allColumns...),
//Columns //Columns
ActorID: ActorIDColumn, ActorID: ActorIDColumn,
@ -53,7 +65,7 @@ func newActorInfoTable() *ActorInfoTable {
LastName: LastNameColumn, LastName: LastNameColumn,
FilmInfo: FilmInfoColumn, FilmInfo: FilmInfoColumn,
AllColumns: postgres.ColumnList{ActorIDColumn, FirstNameColumn, LastNameColumn, FilmInfoColumn}, AllColumns: allColumns,
MutableColumns: postgres.ColumnList{ActorIDColumn, FirstNameColumn, LastNameColumn, FilmInfoColumn}, MutableColumns: mutableColumns,
} }
} }

View file

@ -1,6 +1,5 @@
// //
// Code generated by go-jet DO NOT EDIT. // Code generated by go-jet DO NOT EDIT.
// Generated at Thursday, 26-Sep-19 12:02:13 CEST
// //
// WARNING: Changes to this file may cause incorrect behavior // WARNING: Changes to this file may cause incorrect behavior
// and will be lost if the code is regenerated // and will be lost if the code is regenerated
@ -14,7 +13,7 @@ import (
var CustomerList = newCustomerListTable() var CustomerList = newCustomerListTable()
type CustomerListTable struct { type customerListTable struct {
postgres.Table postgres.Table
//Columns //Columns
@ -32,30 +31,43 @@ type CustomerListTable struct {
MutableColumns postgres.ColumnList MutableColumns postgres.ColumnList
} }
// creates new CustomerListTable with assigned alias type CustomerListTable struct {
customerListTable
EXCLUDED customerListTable
}
// AS creates new CustomerListTable with assigned alias
func (a *CustomerListTable) AS(alias string) *CustomerListTable { func (a *CustomerListTable) AS(alias string) *CustomerListTable {
aliasTable := newCustomerListTable() aliasTable := newCustomerListTable()
aliasTable.Table.AS(alias) aliasTable.Table.AS(alias)
return aliasTable return aliasTable
} }
func newCustomerListTable() *CustomerListTable { func newCustomerListTable() *CustomerListTable {
return &CustomerListTable{
customerListTable: newCustomerListTableImpl("dvds", "customer_list"),
EXCLUDED: newCustomerListTableImpl("", "excluded"),
}
}
func newCustomerListTableImpl(schemaName, tableName string) customerListTable {
var ( var (
IDColumn = postgres.IntegerColumn("id") IDColumn = postgres.IntegerColumn("id")
NameColumn = postgres.StringColumn("name") NameColumn = postgres.StringColumn("name")
AddressColumn = postgres.StringColumn("address") AddressColumn = postgres.StringColumn("address")
ZipCodeColumn = postgres.StringColumn("zip code") ZipCodeColumn = postgres.StringColumn("zip code")
PhoneColumn = postgres.StringColumn("phone") PhoneColumn = postgres.StringColumn("phone")
CityColumn = postgres.StringColumn("city") CityColumn = postgres.StringColumn("city")
CountryColumn = postgres.StringColumn("country") CountryColumn = postgres.StringColumn("country")
NotesColumn = postgres.StringColumn("notes") NotesColumn = postgres.StringColumn("notes")
SidColumn = postgres.IntegerColumn("sid") SidColumn = postgres.IntegerColumn("sid")
allColumns = postgres.ColumnList{IDColumn, NameColumn, AddressColumn, ZipCodeColumn, PhoneColumn, CityColumn, CountryColumn, NotesColumn, SidColumn}
mutableColumns = postgres.ColumnList{IDColumn, NameColumn, AddressColumn, ZipCodeColumn, PhoneColumn, CityColumn, CountryColumn, NotesColumn, SidColumn}
) )
return &CustomerListTable{ return customerListTable{
Table: postgres.NewTable("dvds", "customer_list", IDColumn, NameColumn, AddressColumn, ZipCodeColumn, PhoneColumn, CityColumn, CountryColumn, NotesColumn, SidColumn), Table: postgres.NewTable(schemaName, tableName, allColumns...),
//Columns //Columns
ID: IDColumn, ID: IDColumn,
@ -68,7 +80,7 @@ func newCustomerListTable() *CustomerListTable {
Notes: NotesColumn, Notes: NotesColumn,
Sid: SidColumn, Sid: SidColumn,
AllColumns: postgres.ColumnList{IDColumn, NameColumn, AddressColumn, ZipCodeColumn, PhoneColumn, CityColumn, CountryColumn, NotesColumn, SidColumn}, AllColumns: allColumns,
MutableColumns: postgres.ColumnList{IDColumn, NameColumn, AddressColumn, ZipCodeColumn, PhoneColumn, CityColumn, CountryColumn, NotesColumn, SidColumn}, MutableColumns: mutableColumns,
} }
} }

View file

@ -3,10 +3,10 @@
This package contains sample usage for Jet framework. This package contains sample usage for Jet framework.
Jet generated files of interest are in ./gen folder. Jet generated files of interest are in `./gen` folder.
quick-start.go contains code explained at [README.md](../../README.md#quick-start), `quick-start.go` - contains code explained at main [README.md](../../README.md#quick-start),
with difference of redirecting json output to files(dest.json and dest2.json) rather then to a with a difference of redirecting json output to files(`dest.json` and `dest2.json`) rather then to a
standard output. standard output.
./gen, dest.json and dest2.json - added to git for presentation purposes. `./gen`, `dest.json` and `dest2.json` - added to git for presentation purposes.

View file

@ -7,7 +7,7 @@ import (
_ "github.com/lib/pq" _ "github.com/lib/pq"
"io/ioutil" "io/ioutil"
// dot import so go code would resemble as much as native SQL // dot import so that jet go code would resemble as much as native SQL
// dot import is not mandatory // dot import is not mandatory
. "github.com/go-jet/jet/examples/quick-start/.gen/jetdb/dvds/table" . "github.com/go-jet/jet/examples/quick-start/.gen/jetdb/dvds/table"
. "github.com/go-jet/jet/postgres" . "github.com/go-jet/jet/postgres"
@ -98,15 +98,15 @@ func printStatementInfo(stmt SelectStatement) {
query, args := stmt.Sql() query, args := stmt.Sql()
fmt.Println("Parameterized query: ") fmt.Println("Parameterized query: ")
fmt.Println("==============================")
fmt.Println(query) fmt.Println(query)
fmt.Println("Arguments: ") fmt.Println("Arguments: ")
fmt.Println(args) fmt.Println(args)
debugSQL := stmt.DebugSql() debugSQL := stmt.DebugSql()
fmt.Println("\n\n==============================")
fmt.Println("\n\nDebug sql: ") fmt.Println("\n\nDebug sql: ")
fmt.Println("==============================")
fmt.Println(debugSQL) fmt.Println(debugSQL)
} }