61 lines
1.3 KiB
Go
61 lines
1.3 KiB
Go
// Code generated by sqlc. DO NOT EDIT.
|
|
// versions:
|
|
// sqlc v1.19.1
|
|
// source: queries.sql
|
|
|
|
package store
|
|
|
|
import (
|
|
"context"
|
|
)
|
|
|
|
const addItem = `-- name: AddItem :exec
|
|
INSERT OR REPLACE INTO replied_items (id, reply_id, item_type, updated_time) VALUES (?, -1, ?, ?)
|
|
`
|
|
|
|
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
|
|
}
|
|
|
|
const getItem = `-- name: GetItem :one
|
|
SELECT id, reply_id, item_type, updated_time FROM replied_items WHERE item_type = ? AND id = ? LIMIT 1
|
|
`
|
|
|
|
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
|
|
}
|
|
|
|
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
|
|
}
|