Files
mmaschedule/events/query.sql.go
T
2025-02-08 04:44:51 -06:00

61 lines
1.1 KiB
Go

// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.26.0
// source: query.sql
package events
import (
"context"
)
const createEvent = `-- name: CreateEvent :exec
INSERT INTO
db_events (url)
VALUES
(?) ON CONFLICT (url) DO NOTHING
`
func (q *Queries) CreateEvent(ctx context.Context, url string) error {
_, err := q.db.ExecContext(ctx, createEvent, url)
return err
}
const getEvent = `-- name: GetEvent :one
SELECT
url, data, history
FROM
db_events
WHERE
url = ?
LIMIT
1
`
func (q *Queries) GetEvent(ctx context.Context, url string) (DbEvent, error) {
row := q.db.QueryRowContext(ctx, getEvent, url)
var i DbEvent
err := row.Scan(&i.Url, &i.Data, &i.History)
return i, err
}
const updateEvent = `-- name: UpdateEvent :exec
UPDATE db_events
set
data = ?,
history = ?
WHERE
url = ?
`
type UpdateEventParams struct {
Data []byte `json:"data"`
History []byte `json:"history"`
Url string `json:"url"`
}
func (q *Queries) UpdateEvent(ctx context.Context, arg UpdateEventParams) error {
_, err := q.db.ExecContext(ctx, updateEvent, arg.Data, arg.History, arg.Url)
return err
}