slack5-1770529463/services/preferences-api/internal/port/preference.go
rdev-worker 73532902e7
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
build: /implement-feature user-preferences
2026-02-08 06:13:10 +00:00

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
}