func (p *MySQL) GetEvents(ctx context.Context, batchSize int32) ([]*outboxer.OutboxMessage, error) {
	var events []*outboxer.OutboxMessage

	// nolint
	rows, err := p.conn.QueryContext(ctx, fmt.Sprintf("SELECT * FROM %s WHERE dispatched = false LIMIT %d", p.EventStoreTable, batchSize))
	if err != nil {
		return events, fmt.Errorf("failed to get messages from store: %w", err)
	}

	for rows.Next() {
		var e outboxer.OutboxMessage

		err = rows.Scan(&e.ID, &e.Dispatched, &e.DispatchedAt, &e.Payload, &e.Options, &e.Headers)
		if err != nil {
			return events, fmt.Errorf("failed to scan message: %w", err)
		}

		events = append(events, &e)
	}

	return events, nil
}
// GetEvents retrieves all the relevant events
GetEvents retrieves all the relevant events
// GetEvents retrieves all the relevant events
func (p *MySQL) GetEvents(ctx context.Context, batchSize int32) ([]*outboxer.OutboxMessage, error) {
	var events []*outboxer.OutboxMessage
	rows, err := p.conn.QueryContext(ctx, fmt.Sprintf("SELECT * FROM %s WHERE dispatched = false LIMIT %d", p.EventStoreTable, batchSize))
	if err != nil {
		return events, fmt.Errorf("failed to get messages from store: %w", err)
	}
	for rows.Next() {
		var e outboxer.OutboxMessage
		err = rows.Scan(&e.ID, &e.Dispatched, &e.DispatchedAt, &e.Payload, &e.Options, &e.Headers)
		if err != nil {
			return events, fmt.Errorf("failed to scan message: %w", err)
		}
		events = append(events, &e)
	}
	return events, nil
}
func ( p * MySQL ) GetEvents ( ctx context . Context , batchSize int32 ) ( [ ] * outboxer . OutboxMessage , error ) { var events [ ] * outboxer . OutboxMessage rows , err := p . conn . QueryContext ( ctx , fmt . Sprintf ( " " , p . EventStoreTable , batchSize ) ) if err != nil { return events , fmt . Errorf ( " " , err ) } for rows . Next ( ) { var e outboxer . OutboxMessage err = rows . Scan ( & e . ID , & e . Dispatched , & e . DispatchedAt , & e . Payload , & e . Options , & e . Headers ) if err != nil { return events , fmt . Errorf ( " " , err ) } events = append ( events , & e ) } return events , nil }
GetEvents retrieves all the relevant events
GetEvents retrieves all the relevant events
// nolint