aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/database/sqlc/conferences.sql.go
diff options
context:
space:
mode:
authorLeonardo Bishop <me@leonardobishop.com>2025-08-23 22:29:28 +0100
committerLeonardo Bishop <me@leonardobishop.com>2025-08-23 22:29:28 +0100
commitecc6a55aba7bb35fc778e7a53848396b88214151 (patch)
tree1b37a2dc5f4594155114da1ae0c4529d20a4c548 /pkg/database/sqlc/conferences.sql.go
parent8f7dec8ba6b2f9bde01afd0a110596ebbd43e0ed (diff)
Add multiple conferences feature
Diffstat (limited to 'pkg/database/sqlc/conferences.sql.go')
-rw-r--r--pkg/database/sqlc/conferences.sql.go119
1 files changed, 119 insertions, 0 deletions
diff --git a/pkg/database/sqlc/conferences.sql.go b/pkg/database/sqlc/conferences.sql.go
new file mode 100644
index 0000000..1345185
--- /dev/null
+++ b/pkg/database/sqlc/conferences.sql.go
@@ -0,0 +1,119 @@
+// Code generated by sqlc. DO NOT EDIT.
+// versions:
+// sqlc v1.29.0
+// source: conferences.sql
+
+package sqlc
+
+import (
+ "context"
+
+ "github.com/jackc/pgx/v5/pgtype"
+)
+
+const createConference = `-- name: CreateConference :one
+INSERT INTO conferences (
+ url, title, venue, city
+) VALUES (
+ $1, $2, $3, $4
+)
+RETURNING id, url, title, venue, city
+`
+
+type CreateConferenceParams struct {
+ Url string `json:"url"`
+ Title pgtype.Text `json:"title"`
+ Venue pgtype.Text `json:"venue"`
+ City pgtype.Text `json:"city"`
+}
+
+func (q *Queries) CreateConference(ctx context.Context, arg CreateConferenceParams) (Conference, error) {
+ row := q.db.QueryRow(ctx, createConference,
+ arg.Url,
+ arg.Title,
+ arg.Venue,
+ arg.City,
+ )
+ var i Conference
+ err := row.Scan(
+ &i.ID,
+ &i.Url,
+ &i.Title,
+ &i.Venue,
+ &i.City,
+ )
+ return i, err
+}
+
+const deleteConference = `-- name: DeleteConference :exec
+DELETE FROM conferences
+WHERE id = $1
+`
+
+func (q *Queries) DeleteConference(ctx context.Context, id int32) error {
+ _, err := q.db.Exec(ctx, deleteConference, id)
+ return err
+}
+
+const getConferences = `-- name: GetConferences :many
+SELECT id, url, title, venue, city FROM conferences
+`
+
+func (q *Queries) GetConferences(ctx context.Context) ([]Conference, error) {
+ rows, err := q.db.Query(ctx, getConferences)
+ if err != nil {
+ return nil, err
+ }
+ defer rows.Close()
+ var items []Conference
+ for rows.Next() {
+ var i Conference
+ if err := rows.Scan(
+ &i.ID,
+ &i.Url,
+ &i.Title,
+ &i.Venue,
+ &i.City,
+ ); err != nil {
+ return nil, err
+ }
+ items = append(items, i)
+ }
+ if err := rows.Err(); err != nil {
+ return nil, err
+ }
+ return items, nil
+}
+
+const updateConferenceDetails = `-- name: UpdateConferenceDetails :one
+UPDATE conferences SET (
+ title, venue, city
+) = ($2, $3, $4)
+WHERE id = $1
+RETURNING id, url, title, venue, city
+`
+
+type UpdateConferenceDetailsParams struct {
+ ID int32 `json:"id"`
+ Title pgtype.Text `json:"title"`
+ Venue pgtype.Text `json:"venue"`
+ City pgtype.Text `json:"city"`
+}
+
+func (q *Queries) UpdateConferenceDetails(ctx context.Context, arg UpdateConferenceDetailsParams) (Conference, error) {
+ row := q.db.QueryRow(ctx, updateConferenceDetails,
+ arg.ID,
+ arg.Title,
+ arg.Venue,
+ arg.City,
+ )
+ var i Conference
+ err := row.Scan(
+ &i.ID,
+ &i.Url,
+ &i.Title,
+ &i.Venue,
+ &i.City,
+ )
+ return i, err
+}