update sqlc gen

This commit is contained in:
Pavel 2024-05-13 14:05:04 +03:00
parent 38170308bd
commit a3bce771c9
3 changed files with 30 additions and 3 deletions

@ -1,6 +1,6 @@
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.25.0
// sqlc v1.26.0
package sqlcgen

@ -1,6 +1,6 @@
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.25.0
// sqlc v1.26.0
package sqlcgen

@ -1,6 +1,6 @@
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.25.0
// sqlc v1.26.0
// source: queries.sql
package sqlcgen
@ -1916,6 +1916,33 @@ func (q *Queries) SoftDeleteResultByID(ctx context.Context, id int64) error {
return err
}
const templateCopy = `-- name: TemplateCopy :exec
WITH copied_quiz AS (
INSERT INTO quiz (accountid, name,fingerprinting,repeatable,note_prevented,mail_notifications,unique_answers,super,group_id, description, config, status,limit_answers,due_to,time_of_passing,pausable,version,version_comment, parent_ids)
SELECT $1 AS accountid,name,fingerprinting,repeatable,note_prevented,mail_notifications,unique_answers,super,group_id, description, config, status AS status,limit_answers,due_to,time_of_passing,pausable,version,version_comment, parent_ids
FROM quiz
WHERE qid = $2
RETURNING id
),update_status AS (
UPDATE quiz SET status = 'stop' WHERE qid = $2
)
INSERT INTO question (quiz_id, title, description, questiontype, required, deleted, page, content, version, parent_ids)
SELECT cq.id AS quiz_id, q.title, q.description, q.questiontype, q.required, q.deleted, q.page, q.content, q.version, q.parent_ids
FROM question q
JOIN quiz old ON q.quiz_id = old.id
JOIN copied_quiz cq ON old.qid = $2
`
type TemplateCopyParams struct {
Accountid string `db:"accountid" json:"accountid"`
Qid uuid.NullUUID `db:"qid" json:"qid"`
}
func (q *Queries) TemplateCopy(ctx context.Context, arg TemplateCopyParams) error {
_, err := q.db.ExecContext(ctx, templateCopy, arg.Accountid, arg.Qid)
return err
}
const updatePrivilege = `-- name: UpdatePrivilege :exec
UPDATE privileges SET amount = $1, created_at = $2 WHERE account_id = $3 AND privilegeID = $4
`