// Code generated by sqlc. DO NOT EDIT.
// versions:
//   sqlc v1.26.0
// source: query.sql

package store

import "context"

type Event struct {
	ID          int64
	EndpointURL string
	Payload     []byte
}

func (q *Queries) PendingEvents(ctx context.Context, limit int32) ([]Event, error) {
	return q.list(ctx, "SELECT id, endpoint_url, payload FROM events WHERE state = 'pending' ORDER BY id LIMIT $1", limit)
}

func (q *Queries) DeadEvents(ctx context.Context) ([]Event, error) {
	return q.list(ctx, "SELECT id, endpoint_url, payload FROM events WHERE state = 'dead' ORDER BY id")
}

func (q *Queries) MarkDelivered(ctx context.Context, id int64) error {
	return q.exec(ctx, "UPDATE events SET state = 'delivered' WHERE id = $1", id)
}

func (q *Queries) MarkDead(ctx context.Context, id int64) error {
	return q.exec(ctx, "UPDATE events SET state = 'dead' WHERE id = $1", id)
}
