-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquerier.go
More file actions
54 lines (41 loc) · 2.33 KB
/
querier.go
File metadata and controls
54 lines (41 loc) · 2.33 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
// Code generated by sqlc. DO NOT EDIT.
package postgresdb
import (
"context"
)
type Querier interface {
// AddBookTag adds a tag to a book.
// INSERT INTO book_tags ("book_id", "tag_id") VALUES ($1, $2)
AddBookTag(ctx context.Context, arg AddBookTagParams) error
// AddBookTags adds multiple tags to a book.
// INSERT INTO book_tags ("book_id", "tag_id") VALUES (unnest($1::bigint[]), unnest($2::bigint[]))
// @bulk-for AddBookTag
AddBookTags(ctx context.Context, arg AddBookTagsParams) error
// CreateBook creates a new book.
// 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)
// CreateTag creates a new tag.
// INSERT INTO tags ("name") VALUES ($1) RETURNING "id", "name", "created_at", "updated_at"
CreateTag(ctx context.Context, name string) (Tag, error)
// DeleteBook deletes a book by ID.
// DELETE FROM books WHERE id = $1
DeleteBook(ctx context.Context, id int64) error
// GetBook retrieves a book by ID.
// SELECT "id", "title", "author", "description", "created_at", "updated_at" FROM books WHERE id = $1
GetBook(ctx context.Context, id int64) (Book, error)
// GetBookTags retrieves all tags for a book.
// 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)
// GetBooksByAuthor retrieves all books by an author.
// SELECT "id", "title", "author", "description", "created_at", "updated_at" FROM books WHERE author = $1
GetBooksByAuthor(ctx context.Context, author string) ([]Book, error)
// GetTag retrieves a tag by ID.
// SELECT "id", "name", "created_at", "updated_at" FROM tags WHERE id = $1
GetTag(ctx context.Context, id int64) (Tag, error)
// ListBooks retrieves all books.
// SELECT "id", "title", "author", "description", "created_at", "updated_at" FROM books ORDER BY title
ListBooks(ctx context.Context) ([]Book, error)
// UpdateBook updates a book.
// 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)
}