repo: add some more sql for events
This commit is contained in:
@ -56,3 +56,9 @@ GROUP BY
|
||||
e.total_amount, e.default_currency,
|
||||
o.id, o.first_name, o.last_name;
|
||||
|
||||
-- name: UpdateEventByID :exec
|
||||
UPDATE "event"
|
||||
SET name = $2, description = $3, updated_at = $4
|
||||
WHERE id = $1;
|
||||
|
||||
|
||||
|
@ -172,3 +172,26 @@ func (q *Queries) ListEventsByUserID(ctx context.Context, userID int32) ([]ListE
|
||||
}
|
||||
return items, nil
|
||||
}
|
||||
|
||||
const updateEventByID = `-- name: UpdateEventByID :exec
|
||||
UPDATE "event"
|
||||
SET name = $2, description = $3, updated_at = $4
|
||||
WHERE id = $1
|
||||
`
|
||||
|
||||
type UpdateEventByIDParams struct {
|
||||
ID int32
|
||||
Name string
|
||||
Description sql.NullString
|
||||
UpdatedAt time.Time
|
||||
}
|
||||
|
||||
func (q *Queries) UpdateEventByID(ctx context.Context, arg UpdateEventByIDParams) error {
|
||||
_, err := q.db.ExecContext(ctx, updateEventByID,
|
||||
arg.ID,
|
||||
arg.Name,
|
||||
arg.Description,
|
||||
arg.UpdatedAt,
|
||||
)
|
||||
return err
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
package sqlc
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"time"
|
||||
)
|
||||
|
||||
@ -15,6 +16,26 @@ type Admin struct {
|
||||
AccessLevel int32
|
||||
}
|
||||
|
||||
type Event struct {
|
||||
ID int32
|
||||
Name string
|
||||
Description sql.NullString
|
||||
DefaultCurrency string
|
||||
OwnerID int32
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
TotalAmount sql.NullInt32
|
||||
}
|
||||
|
||||
type Participation struct {
|
||||
ID int32
|
||||
UserID int32
|
||||
EventID int32
|
||||
InvitedByUserID sql.NullInt32
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
}
|
||||
|
||||
type User struct {
|
||||
ID int32
|
||||
Email string
|
||||
|
Reference in New Issue
Block a user