This commit is contained in:
oneao committed 2026-01-15 17:27:33 +08:00
1 parent b38583a9fe
commit 5bf69e977b
12 files changed
+425 -153

No files matched your search

@@ -18,4 +18,8 @@ WHERE id = $1;
-- name: DeleteMoneyCategoryByUserId :exec
DELETE FROM money_user_category
WHERE user_id = $1;
WHERE user_id = $1;
-- name: InsertMoneyUserCategory :exec
INSERT INTO money_user_category (id, user_id, name, icon, type, sort_number)
VALUES ($1, $2, $3, $4, $5, $6);
@@ -71,3 +71,29 @@ func (q *Queries) FindUserMoneyCategoriesByUserID(ctx context.Context, userID in
}
return items, nil
}
const insertMoneyUserCategory = `-- name: InsertMoneyUserCategory :exec
INSERT INTO money_user_category (id, user_id, name, icon, type, sort_number)
VALUES ($1, $2, $3, $4, $5, $6)
`
type InsertMoneyUserCategoryParams struct {
ID int64
UserID int64
Name string
Icon string
Type int32
SortNumber int32
}
func (q *Queries) InsertMoneyUserCategory(ctx context.Context, arg InsertMoneyUserCategoryParams) error {
_, err := q.db.Exec(ctx, insertMoneyUserCategory,
arg.ID,
arg.UserID,
arg.Name,
arg.Icon,
arg.Type,
arg.SortNumber,
)
return err
}