summaryrefslogtreecommitdiff
path: root/model/categories.sql.go
diff options
context:
space:
mode:
Diffstat (limited to 'model/categories.sql.go')
-rw-r--r--model/categories.sql.go46
1 files changed, 46 insertions, 0 deletions
diff --git a/model/categories.sql.go b/model/categories.sql.go
new file mode 100644
index 0000000..74eb8a9
--- /dev/null
+++ b/model/categories.sql.go
@@ -0,0 +1,46 @@
+// Code generated by sqlc. DO NOT EDIT.
+// versions:
+// sqlc v1.25.0
+// source: categories.sql
+
+package model
+
+import (
+ "context"
+)
+
+const getCategories = `-- name: GetCategories :many
+SELECT id, name
+ FROM categories
+ WHERE user_id = $1
+`
+
+type GetCategoriesRow struct {
+ ID int32
+ Name string
+}
+
+// GetCategories
+//
+// SELECT id, name
+// FROM categories
+// WHERE user_id = $1
+func (q *Queries) GetCategories(ctx context.Context, userID int32) ([]GetCategoriesRow, error) {
+ rows, err := q.db.Query(ctx, getCategories, userID)
+ if err != nil {
+ return nil, err
+ }
+ defer rows.Close()
+ var items []GetCategoriesRow
+ for rows.Next() {
+ var i GetCategoriesRow
+ if err := rows.Scan(&i.ID, &i.Name); err != nil {
+ return nil, err
+ }
+ items = append(items, i)
+ }
+ if err := rows.Err(); err != nil {
+ return nil, err
+ }
+ return items, nil
+}