2023-08-19 02:10:43 +00:00
|
|
|
// Code generated by sqlc. DO NOT EDIT.
|
|
|
|
// versions:
|
|
|
|
// sqlc v1.19.1
|
|
|
|
// source: queries.sql
|
|
|
|
|
|
|
|
package store
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
)
|
|
|
|
|
|
|
|
const addItem = `-- name: AddItem :exec
|
2023-09-02 22:52:26 +00:00
|
|
|
INSERT OR REPLACE INTO replied_items (id, reply_id, item_type, updated_time) VALUES (?, -1, ?, ?)
|
2023-08-19 02:10:43 +00:00
|
|
|
`
|
|
|
|
|
|
|
|
type AddItemParams struct {
|
|
|
|
ID int64
|
|
|
|
ItemType string
|
|
|
|
UpdatedTime int64
|
|
|
|
}
|
|
|
|
|
|
|
|
func (q *Queries) AddItem(ctx context.Context, arg AddItemParams) error {
|
|
|
|
_, err := q.db.ExecContext(ctx, addItem, arg.ID, arg.ItemType, arg.UpdatedTime)
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2023-09-02 22:52:26 +00:00
|
|
|
const getItem = `-- name: GetItem :one
|
|
|
|
SELECT id, reply_id, item_type, updated_time FROM replied_items WHERE item_type = ? AND id = ? LIMIT 1
|
2023-08-19 02:10:43 +00:00
|
|
|
`
|
|
|
|
|
2023-09-02 22:52:26 +00:00
|
|
|
type GetItemParams struct {
|
|
|
|
ItemType string
|
|
|
|
ID int64
|
|
|
|
}
|
|
|
|
|
|
|
|
func (q *Queries) GetItem(ctx context.Context, arg GetItemParams) (RepliedItem, error) {
|
|
|
|
row := q.db.QueryRowContext(ctx, getItem, arg.ItemType, arg.ID)
|
|
|
|
var i RepliedItem
|
|
|
|
err := row.Scan(
|
|
|
|
&i.ID,
|
|
|
|
&i.ReplyID,
|
|
|
|
&i.ItemType,
|
|
|
|
&i.UpdatedTime,
|
|
|
|
)
|
|
|
|
return i, err
|
2023-08-19 02:10:43 +00:00
|
|
|
}
|
|
|
|
|
2023-09-02 22:52:26 +00:00
|
|
|
const setReplyID = `-- name: SetReplyID :exec
|
|
|
|
UPDATE replied_items SET reply_id = ? WHERE id = ?
|
|
|
|
`
|
|
|
|
|
|
|
|
type SetReplyIDParams struct {
|
|
|
|
ReplyID int64
|
|
|
|
ID int64
|
|
|
|
}
|
|
|
|
|
|
|
|
func (q *Queries) SetReplyID(ctx context.Context, arg SetReplyIDParams) error {
|
|
|
|
_, err := q.db.ExecContext(ctx, setReplyID, arg.ReplyID, arg.ID)
|
|
|
|
return err
|
2023-08-19 02:10:43 +00:00
|
|
|
}
|