repository

package
v0.0.0-...-2574a71 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 3, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const TimestampLayout = time.RFC3339

Variables

This section is empty.

Functions

This section is empty.

Types

type CountedEventDTO

type CountedEventDTO struct {
	EventWithUsersDTO
	TotalCount uint64 `db:"total_count"`
}

func (CountedEventDTO) ToModel

func (dto CountedEventDTO) ToModel() (models.Event, error)

type EventDTO

type EventDTO struct {
	ID        uint64 `db:"id"`
	Name      string `db:"name"`
	Timestamp string `db:"timestamp"`
}

type EventUserDTO

type EventUserDTO struct {
	UserID  uint64 `db:"user_id"`
	EventID uint64 `db:"event_id"`
}

type EventWithUsersDTO

type EventWithUsersDTO struct {
	EventDTO
	UserIDs []uint64 `db:"user_ids"`
}

func (EventWithUsersDTO) ToModel

func (dto EventWithUsersDTO) ToModel() (models.Event, error)

type EventsDTO

type EventsDTO []CountedEventDTO

func (EventsDTO) ToModel

func (dto EventsDTO) ToModel() ([]models.Event, uint64, error)

type SqlxRepository

type SqlxRepository struct {
	// contains filtered or unexported fields
}

func NewSqlx

func NewSqlx(db *sqlx.DB, logger *slog.Logger) *SqlxRepository

func (*SqlxRepository) CreateEvent

func (r *SqlxRepository) CreateEvent(ctx context.Context, name string, timestamp time.Time, userIDs []uint64) (uint64, error)

func (*SqlxRepository) DeleteEvent

func (r *SqlxRepository) DeleteEvent(ctx context.Context, id uint64) error

func (*SqlxRepository) GetEvent

func (r *SqlxRepository) GetEvent(ctx context.Context, id uint64) (models.Event, bool, error)

func (*SqlxRepository) GetEvents

func (r *SqlxRepository) GetEvents(ctx context.Context, limit, offset uint64) ([]models.Event, uint64, error)

func (*SqlxRepository) GetEventsByUser

func (r *SqlxRepository) GetEventsByUser(ctx context.Context, userID, limit, offset uint64) ([]models.Event, uint64, error)

func (*SqlxRepository) HealthCheck

func (r *SqlxRepository) HealthCheck(ctx context.Context) error

func (*SqlxRepository) UpdateEvent

func (r *SqlxRepository) UpdateEvent(ctx context.Context, event models.Event) (found bool, err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL