16 lines
646 B
Go
16 lines
646 B
Go
// Package port defines interfaces (ports) for external dependencies.
|
|
package port
|
|
|
|
import "context"
|
|
|
|
// PreferenceRepository defines the interface for preference persistence operations.
|
|
type PreferenceRepository interface {
|
|
// GetByUserID returns all preferences for a user as a map[key]value.
|
|
// Returns an empty map if the user has no preferences.
|
|
GetByUserID(ctx context.Context, userID string) (map[string]string, error)
|
|
|
|
// Upsert creates or updates preferences for a user.
|
|
// Only the provided keys are affected; existing keys not in the map are preserved.
|
|
Upsert(ctx context.Context, userID string, prefs map[string]string) error
|
|
}
|