-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerated_querier.go
More file actions
86 lines (83 loc) · 3.44 KB
/
generated_querier.go
File metadata and controls
86 lines (83 loc) · 3.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// Code generated by sqlc-multi-db. DO NOT EDIT.
package database
import (
"context"
"database/sql"
)
type Querier interface {
// INSERT INTO book_tags ("book_id", "tag_id") VALUES ($1, $2)
//
// INSERT INTO book_tags ("book_id", "tag_id")
// VALUES ($1, $2)
AddBookTag(ctx context.Context, arg AddBookTagParams) error
// INSERT INTO book_tags ("book_id", "tag_id") VALUES (unnest($1::bigint[]), unnest($2::bigint[]))
// @bulk-for AddBookTag
//
// INSERT INTO book_tags ("book_id", "tag_id")
// VALUES (unnest($1::bigint[]), unnest($2::bigint[]))
AddBookTags(ctx context.Context, arg AddBookTagsParams) error
// INSERT INTO books ("title", "author", "description") VALUES ($1, $2, $3) RETURNING "id", "title", "author", "description", "created_at", "updated_at"
//
// INSERT INTO books ("title", "author", "description")
// VALUES ($1, $2, $3)
// RETURNING "id", "title", "author", "description", "created_at", "updated_at"
CreateBook(ctx context.Context, arg CreateBookParams) (Book, error)
// INSERT INTO tags ("name") VALUES ($1) RETURNING "id", "name", "created_at", "updated_at"
//
// INSERT INTO tags ("name")
// VALUES ($1)
// RETURNING "id", "name", "created_at", "updated_at"
CreateTag(ctx context.Context, name string) (Tag, error)
// DELETE FROM books WHERE id = $1
//
// DELETE FROM books
// WHERE id = $1
DeleteBook(ctx context.Context, id int64) error
// SELECT "id", "title", "author", "description", "created_at", "updated_at" FROM books WHERE id = $1
//
// SELECT "id", "title", "author", "description", "created_at", "updated_at"
// FROM books
// WHERE id = $1
GetBook(ctx context.Context, id int64) (Book, error)
// GetBookByID (Synthetic)
GetBookByID(ctx context.Context, id int64) (Book, error)
// SELECT t."id", t."name", t."created_at", t."updated_at" FROM tags t INNER JOIN book_tags bt ON t.id = bt.tag_id WHERE bt.book_id = $1
//
// SELECT t."id", t."name", t."created_at", t."updated_at"
// FROM tags t
// INNER JOIN book_tags bt ON t.id = bt.tag_id
// WHERE bt.book_id = $1
GetBookTags(ctx context.Context, bookID int64) ([]Tag, error)
// SELECT "id", "title", "author", "description", "created_at", "updated_at" FROM books WHERE author = $1
//
// SELECT "id", "title", "author", "description", "created_at", "updated_at"
// FROM books
// WHERE author = $1
GetBooksByAuthor(ctx context.Context, author string) ([]Book, error)
// SELECT "id", "name", "created_at", "updated_at" FROM tags WHERE id = $1
//
// SELECT "id", "name", "created_at", "updated_at"
// FROM tags
// WHERE id = $1
GetTag(ctx context.Context, id int64) (Tag, error)
// GetTagByID (Synthetic)
GetTagByID(ctx context.Context, id int64) (Tag, error)
// SELECT "id", "title", "author", "description", "created_at", "updated_at" FROM books ORDER BY title
//
// SELECT "id", "title", "author", "description", "created_at", "updated_at"
// FROM books
// ORDER BY title
ListBooks(ctx context.Context) ([]Book, error)
// UPDATE books SET "title" = $1, "author" = $2, "description" = $3, "updated_at" = NOW() WHERE id = $4 RETURNING "id", "title", "author", "description", "created_at", "updated_at"
//
// UPDATE books
// SET "title" = $1,
// "author" = $2,
// "description" = $3,
// "updated_at" = NOW()
// WHERE id = $4
// RETURNING "id", "title", "author", "description", "created_at", "updated_at"
UpdateBook(ctx context.Context, arg UpdateBookParams) (Book, error)
WithTx(tx *sql.Tx) Querier
DB() *sql.DB
}