From 549609dfb0960aabaee9a6f6b7f5a477b22dca85 Mon Sep 17 00:00:00 2001 From: Colin Date: Wed, 21 Nov 2018 22:30:22 -0500 Subject: [PATCH] Replace usage of package gnorm with {{$rootPkg}} --- generated/public/authors/authors.go | 4 ++-- generated/public/books/books.go | 4 ++-- gnorm_templates/table.gotmpl | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/generated/public/authors/authors.go b/generated/public/authors/authors.go index 67a09f4..cf5a296 100644 --- a/generated/public/authors/authors.go +++ b/generated/public/authors/authors.go @@ -51,7 +51,7 @@ func All(ctx context.Context, db generated.DB) ([]*Row, error) { } // CountQuery retrieve one row from 'authors'. -func CountQuery(ctx context.Context, db gnorm.DB, where gnorm.WhereClause) (int, error) { +func CountQuery(ctx context.Context, db generated.DB, where generated.WhereClause) (int, error) { const origsqlstr = `SELECT count(*) as count FROM public.authors WHERE (` @@ -197,7 +197,7 @@ func Insert(ctx context.Context, db generated.DB, r *Row) error { } // InsertIgnore inserts the row into the database but ignores conflicts -func InsertIgnore(ctx context.Context, db gnorm.DB, r *Row, constraint string) error { +func InsertIgnore(ctx context.Context, db generated.DB, r *Row, constraint string) error { sqlstr := `INSERT INTO public.authors ` + `( name diff --git a/generated/public/books/books.go b/generated/public/books/books.go index dbf7c55..991d98d 100644 --- a/generated/public/books/books.go +++ b/generated/public/books/books.go @@ -72,7 +72,7 @@ func All(ctx context.Context, db generated.DB) ([]*Row, error) { } // CountQuery retrieve one row from 'books'. -func CountQuery(ctx context.Context, db gnorm.DB, where gnorm.WhereClause) (int, error) { +func CountQuery(ctx context.Context, db generated.DB, where generated.WhereClause) (int, error) { const origsqlstr = `SELECT count(*) as count FROM public.books WHERE (` @@ -261,7 +261,7 @@ func Insert(ctx context.Context, db generated.DB, r *Row) error { } // InsertIgnore inserts the row into the database but ignores conflicts -func InsertIgnore(ctx context.Context, db gnorm.DB, r *Row, constraint string) error { +func InsertIgnore(ctx context.Context, db generated.DB, r *Row, constraint string) error { sqlstr := `INSERT INTO public.books ` + `( author_id, available, booktype, isbn, pages, summary, title diff --git a/gnorm_templates/table.gotmpl b/gnorm_templates/table.gotmpl index e3347af..3d2634e 100644 --- a/gnorm_templates/table.gotmpl +++ b/gnorm_templates/table.gotmpl @@ -67,7 +67,7 @@ func All(ctx context.Context, db {{$rootPkg}}.DB) ([]*Row, error) { } // CountQuery retrieve one row from '{{ $table }}'. -func CountQuery(ctx context.Context, db gnorm.DB, where gnorm.WhereClause) (int, error) { +func CountQuery(ctx context.Context, db {{$rootPkg}}.DB, where {{$rootPkg}}.WhereClause) (int, error) { const origsqlstr = `SELECT count(*) as count FROM {{$schema}}.{{ $table }} WHERE (` @@ -278,7 +278,7 @@ func Update(ctx context.Context, db {{$rootPkg}}.DB, r *Row) error { {{end}} // InsertIgnore inserts the row into the database but ignores conflicts -func InsertIgnore(ctx context.Context, db gnorm.DB, r *Row, constraint string) error { +func InsertIgnore(ctx context.Context, db {{$rootPkg}}.DB, r *Row, constraint string) error { sqlstr := `INSERT INTO {{$schema}}.{{ $table }} ` + {{- if gt (len $insertCols) 0}} `(