/
queries-bookmarks.sql.go
63 lines (52 loc) · 1.73 KB
/
queries-bookmarks.sql.go
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
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.21.0
// source: queries-bookmarks.sql
package a4webbm
import (
"context"
"database/sql"
)
const createBookmarks = `-- name: CreateBookmarks :exec
INSERT INTO bookmarks (userReference, list)
VALUES (?, ?)
`
type CreateBookmarksParams struct {
Userreference string
List sql.NullString
}
// This query adds a new entry to the "bookmarks" table and returns the last inserted ID as "returnthis".
func (q *Queries) CreateBookmarks(ctx context.Context, arg CreateBookmarksParams) error {
_, err := q.db.ExecContext(ctx, createBookmarks, arg.Userreference, arg.List)
return err
}
const getBookmarksForUser = `-- name: GetBookmarksForUser :one
SELECT Idbookmarks, list
FROM bookmarks
WHERE userReference = ?
`
type GetBookmarksForUserRow struct {
Idbookmarks int32
List sql.NullString
}
// This query retrieves the "list" from the "bookmarks" table for a specific user based on their "users_idusers".
func (q *Queries) GetBookmarksForUser(ctx context.Context, userreference string) (*GetBookmarksForUserRow, error) {
row := q.db.QueryRowContext(ctx, getBookmarksForUser, userreference)
var i GetBookmarksForUserRow
err := row.Scan(&i.Idbookmarks, &i.List)
return &i, err
}
const updateBookmarks = `-- name: UpdateBookmarks :exec
UPDATE bookmarks
SET list = ?
WHERE userReference = ?
`
type UpdateBookmarksParams struct {
List sql.NullString
Userreference string
}
// This query updates the "list" column in the "bookmarks" table for a specific user based on their "users_idusers".
func (q *Queries) UpdateBookmarks(ctx context.Context, arg UpdateBookmarksParams) error {
_, err := q.db.ExecContext(ctx, updateBookmarks, arg.List, arg.Userreference)
return err
}