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

View file

@ -1,6 +1,5 @@
//
// 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
// and will be lost if the code is regenerated
@ -14,7 +13,7 @@ import (
var CustomerList = newCustomerListTable()
type CustomerListTable struct {
type customerListTable struct {
postgres.Table
//Columns
@ -32,30 +31,43 @@ type CustomerListTable struct {
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 {
aliasTable := newCustomerListTable()
aliasTable.Table.AS(alias)
return aliasTable
}
func newCustomerListTable() *CustomerListTable {
return &CustomerListTable{
customerListTable: newCustomerListTableImpl("dvds", "customer_list"),
EXCLUDED: newCustomerListTableImpl("", "excluded"),
}
}
func newCustomerListTableImpl(schemaName, tableName string) customerListTable {
var (
IDColumn = postgres.IntegerColumn("id")
NameColumn = postgres.StringColumn("name")
AddressColumn = postgres.StringColumn("address")
ZipCodeColumn = postgres.StringColumn("zip code")
PhoneColumn = postgres.StringColumn("phone")
CityColumn = postgres.StringColumn("city")
CountryColumn = postgres.StringColumn("country")
NotesColumn = postgres.StringColumn("notes")
SidColumn = postgres.IntegerColumn("sid")
IDColumn = postgres.IntegerColumn("id")
NameColumn = postgres.StringColumn("name")
AddressColumn = postgres.StringColumn("address")
ZipCodeColumn = postgres.StringColumn("zip code")
PhoneColumn = postgres.StringColumn("phone")
CityColumn = postgres.StringColumn("city")
CountryColumn = postgres.StringColumn("country")
NotesColumn = postgres.StringColumn("notes")
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{
Table: postgres.NewTable("dvds", "customer_list", IDColumn, NameColumn, AddressColumn, ZipCodeColumn, PhoneColumn, CityColumn, CountryColumn, NotesColumn, SidColumn),
return customerListTable{
Table: postgres.NewTable(schemaName, tableName, allColumns...),
//Columns
ID: IDColumn,
@ -68,7 +80,7 @@ func newCustomerListTable() *CustomerListTable {
Notes: NotesColumn,
Sid: SidColumn,
AllColumns: postgres.ColumnList{IDColumn, NameColumn, AddressColumn, ZipCodeColumn, PhoneColumn, CityColumn, CountryColumn, NotesColumn, SidColumn},
MutableColumns: postgres.ColumnList{IDColumn, NameColumn, AddressColumn, ZipCodeColumn, PhoneColumn, CityColumn, CountryColumn, NotesColumn, SidColumn},
AllColumns: allColumns,
MutableColumns: mutableColumns,
}
}