// 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 }