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 Actor = newActorTable()
type ActorTable struct {
type actorTable struct {
postgres.Table
//Columns
@ -27,25 +26,38 @@ type ActorTable struct {
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 {
aliasTable := newActorTable()
aliasTable.Table.AS(alias)
return aliasTable
}
func newActorTable() *ActorTable {
return &ActorTable{
actorTable: newActorTableImpl("dvds", "actor"),
EXCLUDED: newActorTableImpl("", "excluded"),
}
}
func newActorTableImpl(schemaName, tableName string) actorTable {
var (
ActorIDColumn = postgres.IntegerColumn("actor_id")
FirstNameColumn = postgres.StringColumn("first_name")
LastNameColumn = postgres.StringColumn("last_name")
LastUpdateColumn = postgres.TimestampColumn("last_update")
allColumns = postgres.ColumnList{ActorIDColumn, FirstNameColumn, LastNameColumn, LastUpdateColumn}
mutableColumns = postgres.ColumnList{FirstNameColumn, LastNameColumn, LastUpdateColumn}
)
return &ActorTable{
Table: postgres.NewTable("dvds", "actor", ActorIDColumn, FirstNameColumn, LastNameColumn, LastUpdateColumn),
return actorTable{
Table: postgres.NewTable(schemaName, tableName, allColumns...),
//Columns
ActorID: ActorIDColumn,
@ -53,7 +65,7 @@ func newActorTable() *ActorTable {
LastName: LastNameColumn,
LastUpdate: LastUpdateColumn,
AllColumns: postgres.ColumnList{ActorIDColumn, FirstNameColumn, LastNameColumn, LastUpdateColumn},
MutableColumns: postgres.ColumnList{FirstNameColumn, LastNameColumn, LastUpdateColumn},
AllColumns: allColumns,
MutableColumns: mutableColumns,
}
}