Pre-release clean up.
This commit is contained in:
parent
23a27033a4
commit
b817f57035
27 changed files with 628 additions and 79 deletions
|
|
@ -6,8 +6,10 @@ import (
|
|||
"fmt"
|
||||
_ "github.com/lib/pq"
|
||||
|
||||
. "github.com/go-jet/jet" // dot import so go code would resemble as much as native SQL
|
||||
. "github.com/go-jet/jet/examples/quick-start/.gen/jetdb/dvds/table" // dot import is not mandatory
|
||||
// dot import so go code would resemble as much as native SQL
|
||||
// dot import is not mandatory
|
||||
. "github.com/go-jet/jet"
|
||||
. "github.com/go-jet/jet/examples/quick-start/.gen/jetdb/dvds/table"
|
||||
|
||||
"github.com/go-jet/jet/examples/quick-start/.gen/jetdb/dvds/model"
|
||||
"github.com/go-jet/jet/tests/dbconfig"
|
||||
|
|
@ -20,21 +22,21 @@ func main() {
|
|||
defer db.Close()
|
||||
|
||||
stmt := SELECT(
|
||||
Actor.ActorID, Actor.FirstName, Actor.LastName, Actor.LastUpdate, // list of all actor columns (equivalent to Actor.AllColumns)
|
||||
Film.AllColumns, // list of all film columns (equivalent to Film.FilmID, Film.Title, ...)
|
||||
Actor.ActorID, Actor.FirstName, Actor.LastName, Actor.LastUpdate,
|
||||
Film.AllColumns,
|
||||
Language.AllColumns,
|
||||
Category.AllColumns,
|
||||
).FROM(
|
||||
Actor.
|
||||
INNER_JOIN(FilmActor, Actor.ActorID.EQ(FilmActor.ActorID)). // INNER JOIN Actor with FilmActor on condition Actor.ActorID = FilmActor.ActorID
|
||||
INNER_JOIN(Film, Film.FilmID.EQ(FilmActor.FilmID)). // then with Film, Language, FilmCategory and Category.
|
||||
INNER_JOIN(FilmActor, Actor.ActorID.EQ(FilmActor.ActorID)).
|
||||
INNER_JOIN(Film, Film.FilmID.EQ(FilmActor.FilmID)).
|
||||
INNER_JOIN(Language, Language.LanguageID.EQ(Film.LanguageID)).
|
||||
INNER_JOIN(FilmCategory, FilmCategory.FilmID.EQ(Film.FilmID)).
|
||||
INNER_JOIN(Category, Category.CategoryID.EQ(FilmCategory.CategoryID)),
|
||||
).WHERE(
|
||||
Language.Name.EQ(String("English")). // note every column has type.
|
||||
AND(Category.Name.NOT_EQ(String("Action"))). // String column Language.Name and Category.Name can be compared only with string columns and expressions
|
||||
AND(Film.Length.GT(Int(180))), // Film.Length is integer column and can be compared only with integer columns and expressions
|
||||
Language.Name.EQ(String("English")).
|
||||
AND(Category.Name.NOT_EQ(String("Action"))).
|
||||
AND(Film.Length.GT(Int(180))),
|
||||
).ORDER_BY(
|
||||
Actor.ActorID.ASC(),
|
||||
Film.FilmID.ASC(),
|
||||
|
|
@ -70,6 +72,8 @@ func main() {
|
|||
jsonText, _ := json.MarshalIndent(dest, "", "\t")
|
||||
fmt.Println(string(jsonText))
|
||||
|
||||
// New Destination
|
||||
|
||||
var dest2 []struct {
|
||||
model.Category
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue