first commit

Made-with: Cursor
This commit is contained in:
Michilis
2026-02-28 02:17:55 +00:00
commit 41f6ae916f
92 changed files with 12332 additions and 0 deletions

View File

@@ -0,0 +1,74 @@
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.30.0
// source: event_exceptions.sql
package repository
import (
"context"
"github.com/jackc/pgx/v5/pgtype"
)
const createEventException = `-- name: CreateEventException :one
INSERT INTO event_exceptions (id, event_id, exception_date, action)
VALUES ($1, $2, $3, $4)
RETURNING id, event_id, exception_date, action
`
type CreateEventExceptionParams struct {
ID pgtype.UUID `json:"id"`
EventID pgtype.UUID `json:"event_id"`
ExceptionDate pgtype.Date `json:"exception_date"`
Action string `json:"action"`
}
func (q *Queries) CreateEventException(ctx context.Context, arg CreateEventExceptionParams) (EventException, error) {
row := q.db.QueryRow(ctx, createEventException,
arg.ID,
arg.EventID,
arg.ExceptionDate,
arg.Action,
)
var i EventException
err := row.Scan(
&i.ID,
&i.EventID,
&i.ExceptionDate,
&i.Action,
)
return i, err
}
const listExceptionsByEvent = `-- name: ListExceptionsByEvent :many
SELECT id, event_id, exception_date, action
FROM event_exceptions
WHERE event_id = $1
ORDER BY exception_date ASC
`
func (q *Queries) ListExceptionsByEvent(ctx context.Context, eventID pgtype.UUID) ([]EventException, error) {
rows, err := q.db.Query(ctx, listExceptionsByEvent, eventID)
if err != nil {
return nil, err
}
defer rows.Close()
items := []EventException{}
for rows.Next() {
var i EventException
if err := rows.Scan(
&i.ID,
&i.EventID,
&i.ExceptionDate,
&i.Action,
); err != nil {
return nil, err
}
items = append(items, i)
}
if err := rows.Err(); err != nil {
return nil, err
}
return items, nil
}