26 lines
707 B
Go
26 lines
707 B
Go
package port
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
)
|
|
|
|
// PreferenceRow represents a single preference row from the database.
|
|
type PreferenceRow struct {
|
|
UserID string
|
|
Key string
|
|
Value string
|
|
CreatedAt time.Time
|
|
UpdatedAt time.Time
|
|
}
|
|
|
|
// PreferenceRepository defines the interface for preference persistence operations.
|
|
type PreferenceRepository interface {
|
|
// GetByUserID returns all stored preferences for a user.
|
|
// Returns an empty slice (not an error) if no preferences exist.
|
|
GetByUserID(ctx context.Context, userID string) ([]PreferenceRow, error)
|
|
|
|
// Upsert creates or updates a single preference for a user.
|
|
Upsert(ctx context.Context, userID string, key string, value string) error
|
|
}
|