Documentation
¶
Index ¶
- Variables
- type AnalyticsEvent
- type AnalyticsStore
- type BatchOperation
- type BatchResult
- type CacheStore
- type EngagementMetrics
- type FollowStore
- type FollowStoreImpl
- func (s *FollowStoreImpl) Create(ctx context.Context, follow *models.Follow) error
- func (s *FollowStoreImpl) Delete(ctx context.Context, id uuid.UUID) error
- func (s *FollowStoreImpl) DeleteByUsers(ctx context.Context, followerID, followeeID uuid.UUID) error
- func (s *FollowStoreImpl) GetByID(ctx context.Context, id uuid.UUID) (*models.Follow, error)
- func (s *FollowStoreImpl) GetFollowStats(ctx context.Context, userID uuid.UUID) (*models.FollowStats, error)
- func (s *FollowStoreImpl) GetFollowSuggestions(ctx context.Context, userID uuid.UUID, limit int) ([]*models.FollowSuggestion, error)
- func (s *FollowStoreImpl) GetFollowers(ctx context.Context, userID uuid.UUID, limit, offset int) ([]*models.FollowWithUser, error)
- func (s *FollowStoreImpl) GetFollowing(ctx context.Context, userID uuid.UUID, limit, offset int) ([]*models.FollowWithUser, error)
- func (s *FollowStoreImpl) GetMutualFollows(ctx context.Context, userID1, userID2 uuid.UUID) (*models.MutualFollowCheck, error)
- func (s *FollowStoreImpl) IsFollowing(ctx context.Context, followerID, followeeID uuid.UUID) (bool, error)
- type HealthChecker
- type PaginatedResult
- type PlatformMetrics
- type PostgresDB
- func (p *PostgresDB) Close() error
- func (p *PostgresDB) DB() *sqlx.DB
- func (p *PostgresDB) GetStats() SqlDbStats
- func (p *PostgresDB) Health(ctx context.Context) error
- func (p *PostgresDB) Migrate(ctx context.Context, migrationDir string) error
- func (p *PostgresDB) WithTransaction(ctx context.Context, fn func(*sqlx.Tx) error) error
- type ReactionStore
- type ReactionStoreImpl
- func (s *ReactionStoreImpl) Create(ctx context.Context, reaction *models.Reaction) error
- func (s *ReactionStoreImpl) Delete(ctx context.Context, id uuid.UUID) error
- func (s *ReactionStoreImpl) GetByID(ctx context.Context, id uuid.UUID) (*models.Reaction, error)
- func (s *ReactionStoreImpl) GetByStoryID(ctx context.Context, storyID uuid.UUID, limit, offset int) ([]*models.ReactionWithUser, error)
- func (s *ReactionStoreImpl) GetByUserID(ctx context.Context, userID uuid.UUID, limit, offset int) ([]*models.Reaction, error)
- func (s *ReactionStoreImpl) GetReactionStats(ctx context.Context, storyID uuid.UUID) (map[models.ReactionType]int, error)
- func (s *ReactionStoreImpl) GetReactionSummary(ctx context.Context, storyID uuid.UUID) (*models.ReactionSummary, error)
- func (s *ReactionStoreImpl) GetUserReactionForStory(ctx context.Context, storyID, userID uuid.UUID) (*models.Reaction, error)
- func (s *ReactionStoreImpl) Update(ctx context.Context, reaction *models.Reaction) error
- type RedisClient
- func (r *RedisClient) Close() error
- func (r *RedisClient) Decrement(ctx context.Context, key string, value int64) (int64, error)
- func (r *RedisClient) Delete(ctx context.Context, key string) error
- func (r *RedisClient) DeleteMany(ctx context.Context, keys []string) error
- func (r *RedisClient) Eval(ctx context.Context, script string, keys []string, args ...interface{}) *redis.Cmd
- func (r *RedisClient) EvalSha(ctx context.Context, sha1 string, keys []string, args ...interface{}) *redis.Cmd
- func (r *RedisClient) Exists(ctx context.Context, key string) (bool, error)
- func (r *RedisClient) Expire(ctx context.Context, key string, expiration int) error
- func (r *RedisClient) FlushAll(ctx context.Context) error
- func (r *RedisClient) Get(ctx context.Context, key string, dest interface{}) error
- func (r *RedisClient) GetClient() *redis.Client
- func (r *RedisClient) GetMany(ctx context.Context, keys []string) (map[string]interface{}, error)
- func (r *RedisClient) Health(ctx context.Context) error
- func (r *RedisClient) Increment(ctx context.Context, key string, value int64) (int64, error)
- func (r *RedisClient) Info(ctx context.Context, section ...string) *redis.StringCmd
- func (r *RedisClient) Ping(ctx context.Context) *redis.StatusCmd
- func (r *RedisClient) Pipeline() redis.Pipeliner
- func (r *RedisClient) ScriptExists(ctx context.Context, hashes ...string) *redis.BoolSliceCmd
- func (r *RedisClient) ScriptFlush(ctx context.Context) *redis.StatusCmd
- func (r *RedisClient) ScriptKill(ctx context.Context) *redis.StatusCmd
- func (r *RedisClient) ScriptLoad(ctx context.Context, script string) *redis.StringCmd
- func (r *RedisClient) Set(ctx context.Context, key string, value interface{}, expiration int) error
- func (r *RedisClient) SetMany(ctx context.Context, items map[string]interface{}, expiration int) error
- func (r *RedisClient) TTL(ctx context.Context, key string) (int, error)
- type SearchFilters
- type SessionStore
- type SqlDbStats
- type StoreFactory
- type StoryMetrics
- type StoryStore
- type StoryStoreImpl
- func (s *StoryStoreImpl) Create(ctx context.Context, story *models.Story) error
- func (s *StoryStoreImpl) Delete(ctx context.Context, id uuid.UUID) error
- func (s *StoryStoreImpl) GetByAuthorID(ctx context.Context, authorID uuid.UUID, limit, offset int) ([]*models.Story, error)
- func (s *StoryStoreImpl) GetByID(ctx context.Context, id uuid.UUID) (*models.Story, error)
- func (s *StoryStoreImpl) GetExpired(ctx context.Context, limit, offset int) ([]*models.Story, error)
- func (s *StoryStoreImpl) GetFeed(ctx context.Context, userID uuid.UUID, limit, offset int) ([]*models.Story, error)
- func (s *StoryStoreImpl) GetPublic(ctx context.Context, limit, offset int) ([]*models.Story, error)
- func (s *StoryStoreImpl) GetViewCount(ctx context.Context, storyID uuid.UUID) (int, error)
- func (s *StoryStoreImpl) IncrementViewCount(ctx context.Context, storyID uuid.UUID) error
- func (s *StoryStoreImpl) Update(ctx context.Context, story *models.Story) error
- type TopStoryMetric
- type TopUserMetric
- type Transactional
- type UserMetrics
- type UserStore
- type UserStoreImpl
- func (s *UserStoreImpl) Create(ctx context.Context, user *models.User) error
- func (s *UserStoreImpl) Delete(ctx context.Context, id uuid.UUID) error
- func (s *UserStoreImpl) GetByEmail(ctx context.Context, email string) (*models.User, error)
- func (s *UserStoreImpl) GetByID(ctx context.Context, id uuid.UUID) (*models.User, error)
- func (s *UserStoreImpl) GetByUsername(ctx context.Context, username string) (*models.User, error)
- func (s *UserStoreImpl) GetStats(ctx context.Context, userID uuid.UUID) (*models.UserStats, error)
- func (s *UserStoreImpl) List(ctx context.Context, limit, offset int) ([]*models.User, error)
- func (s *UserStoreImpl) Search(ctx context.Context, query string, limit, offset int) ([]*models.User, error)
- func (s *UserStoreImpl) Update(ctx context.Context, user *models.User) error
- func (s *UserStoreImpl) UpdateStats(ctx context.Context, userID uuid.UUID, stats models.UserStats) error
- type ViewStore
- type ViewStoreImpl
- func (s *ViewStoreImpl) Create(ctx context.Context, view *models.StoryView) error
- func (s *ViewStoreImpl) GetByID(ctx context.Context, id uuid.UUID) (*models.StoryView, error)
- func (s *ViewStoreImpl) GetByStoryID(ctx context.Context, storyID uuid.UUID, limit, offset int) ([]*models.StoryViewWithUser, error)
- func (s *ViewStoreImpl) GetByViewerID(ctx context.Context, viewerID uuid.UUID, limit, offset int) ([]*models.StoryView, error)
- func (s *ViewStoreImpl) GetViewAnalytics(ctx context.Context, storyID uuid.UUID, period string) (*models.ViewAnalytics, error)
- func (s *ViewStoreImpl) GetViewStats(ctx context.Context, storyID uuid.UUID) (*models.StoryViewStats, error)
- func (s *ViewStoreImpl) GetViewTrends(ctx context.Context, storyID uuid.UUID) ([]*models.ViewTrend, error)
- func (s *ViewStoreImpl) GetViewerStats(ctx context.Context, viewerID uuid.UUID) (*models.ViewerStats, error)
- func (s *ViewStoreImpl) HasViewed(ctx context.Context, storyID, viewerID uuid.UUID) (bool, error)
Constants ¶
This section is empty.
Variables ¶
var ( ErrNotFound = errors.New("record not found") ErrAlreadyExists = errors.New("record already exists") ErrInvalidInput = errors.New("invalid input") )
Common errors
Functions ¶
This section is empty.
Types ¶
type AnalyticsEvent ¶
type AnalyticsEvent struct {
Type string `json:"type"`
UserID *uuid.UUID `json:"user_id,omitempty"`
StoryID *uuid.UUID `json:"story_id,omitempty"`
Timestamp int64 `json:"timestamp"`
Data map[string]interface{} `json:"data,omitempty"`
}
Analytics types
type AnalyticsStore ¶
type AnalyticsStore interface {
RecordEvent(ctx context.Context, event AnalyticsEvent) error
GetUserMetrics(ctx context.Context, userID uuid.UUID, period string) (*UserMetrics, error)
GetStoryMetrics(ctx context.Context, storyID uuid.UUID, period string) (*StoryMetrics, error)
GetPlatformMetrics(ctx context.Context, period string) (*PlatformMetrics, error)
GetTopStories(ctx context.Context, period string, limit int) ([]*TopStoryMetric, error)
GetTopUsers(ctx context.Context, period string, limit int) ([]*TopUserMetric, error)
GetEngagementMetrics(ctx context.Context, period string) (*EngagementMetrics, error)
}
AnalyticsStore defines the interface for analytics storage operations
type BatchOperation ¶
type BatchOperation struct {
Operation string `json:"operation"`
Data interface{} `json:"data"`
}
Batch operations
type BatchResult ¶
type CacheStore ¶
type CacheStore interface {
Set(ctx context.Context, key string, value interface{}, expiration int) error
Get(ctx context.Context, key string, dest interface{}) error
Delete(ctx context.Context, key string) error
Exists(ctx context.Context, key string) (bool, error)
SetMany(ctx context.Context, items map[string]interface{}, expiration int) error
GetMany(ctx context.Context, keys []string) (map[string]interface{}, error)
DeleteMany(ctx context.Context, keys []string) error
Increment(ctx context.Context, key string, value int64) (int64, error)
Decrement(ctx context.Context, key string, value int64) (int64, error)
Expire(ctx context.Context, key string, expiration int) error
TTL(ctx context.Context, key string) (int, error)
FlushAll(ctx context.Context) error
}
CacheStore defines the interface for caching operations
type EngagementMetrics ¶
type EngagementMetrics struct {
AverageViewsPerStory float64 `json:"average_views_per_story"`
AverageReactionsPerStory float64 `json:"average_reactions_per_story"`
ViewToReactionRatio float64 `json:"view_to_reaction_ratio"`
DailyActiveUsers int `json:"daily_active_users"`
RetentionRate float64 `json:"retention_rate"`
}
type FollowStore ¶
type FollowStore interface {
Create(ctx context.Context, follow *models.Follow) error
Delete(ctx context.Context, id uuid.UUID) error
DeleteByUsers(ctx context.Context, followerID, followeeID uuid.UUID) error
GetByID(ctx context.Context, id uuid.UUID) (*models.Follow, error)
GetFollowers(ctx context.Context, userID uuid.UUID, limit, offset int) ([]*models.FollowWithUser, error)
GetFollowing(ctx context.Context, userID uuid.UUID, limit, offset int) ([]*models.FollowWithUser, error)
IsFollowing(ctx context.Context, followerID, followeeID uuid.UUID) (bool, error)
GetFollowStats(ctx context.Context, userID uuid.UUID) (*models.FollowStats, error)
GetMutualFollows(ctx context.Context, userID1, userID2 uuid.UUID) (*models.MutualFollowCheck, error)
GetFollowSuggestions(ctx context.Context, userID uuid.UUID, limit int) ([]*models.FollowSuggestion, error)
}
FollowStore defines the interface for follow relationship storage operations
func NewFollowStore ¶
func NewFollowStore(db *sqlx.DB, redisClient *RedisClient, logger *zap.Logger) FollowStore
NewFollowStore creates a new follow store
type FollowStoreImpl ¶
type FollowStoreImpl struct {
// contains filtered or unexported fields
}
FollowStoreImpl implements FollowStore interface
func (*FollowStoreImpl) DeleteByUsers ¶
func (s *FollowStoreImpl) DeleteByUsers(ctx context.Context, followerID, followeeID uuid.UUID) error
DeleteByUsers deletes follow relationship by user IDs
func (*FollowStoreImpl) GetFollowStats ¶
func (s *FollowStoreImpl) GetFollowStats(ctx context.Context, userID uuid.UUID) (*models.FollowStats, error)
GetFollowStats gets follow statistics for a user - ADDED MISSING METHOD
func (*FollowStoreImpl) GetFollowSuggestions ¶
func (s *FollowStoreImpl) GetFollowSuggestions(ctx context.Context, userID uuid.UUID, limit int) ([]*models.FollowSuggestion, error)
GetFollowSuggestions gets follow suggestions for a user - ADDED MISSING METHOD
func (*FollowStoreImpl) GetFollowers ¶
func (s *FollowStoreImpl) GetFollowers(ctx context.Context, userID uuid.UUID, limit, offset int) ([]*models.FollowWithUser, error)
GetFollowers gets followers for a user
func (*FollowStoreImpl) GetFollowing ¶
func (s *FollowStoreImpl) GetFollowing(ctx context.Context, userID uuid.UUID, limit, offset int) ([]*models.FollowWithUser, error)
GetFollowing gets users that a user is following
func (*FollowStoreImpl) GetMutualFollows ¶
func (s *FollowStoreImpl) GetMutualFollows(ctx context.Context, userID1, userID2 uuid.UUID) (*models.MutualFollowCheck, error)
GetMutualFollows gets mutual follow status between two users - ADDED MISSING METHOD
func (*FollowStoreImpl) IsFollowing ¶
func (s *FollowStoreImpl) IsFollowing(ctx context.Context, followerID, followeeID uuid.UUID) (bool, error)
IsFollowing checks if user A follows user B
type HealthChecker ¶
Health check interface
type PaginatedResult ¶
type PaginatedResult struct {
Data interface{} `json:"data"`
Total int `json:"total"`
Limit int `json:"limit"`
Offset int `json:"offset"`
HasMore bool `json:"has_more"`
NextOffset *int `json:"next_offset,omitempty"`
}
Paginated results
type PlatformMetrics ¶
type PostgresDB ¶
type PostgresDB struct {
// contains filtered or unexported fields
}
PostgresDB wraps the database connection
func NewPostgresDB ¶
NewPostgresDB creates a new PostgreSQL database connection
func (*PostgresDB) DB ¶
func (p *PostgresDB) DB() *sqlx.DB
DB returns the underlying database connection
func (*PostgresDB) GetStats ¶
func (p *PostgresDB) GetStats() SqlDbStats
GetStats returns database connection statistics
func (*PostgresDB) Health ¶
func (p *PostgresDB) Health(ctx context.Context) error
Health checks the database connection health
func (*PostgresDB) Migrate ¶
func (p *PostgresDB) Migrate(ctx context.Context, migrationDir string) error
Migrate runs database migrations
func (*PostgresDB) WithTransaction ¶
WithTransaction executes a function within a database transaction
type ReactionStore ¶
type ReactionStore interface {
Create(ctx context.Context, reaction *models.Reaction) error
GetByID(ctx context.Context, id uuid.UUID) (*models.Reaction, error)
GetByStoryID(ctx context.Context, storyID uuid.UUID, limit, offset int) ([]*models.ReactionWithUser, error)
GetByUserID(ctx context.Context, userID uuid.UUID, limit, offset int) ([]*models.Reaction, error)
Update(ctx context.Context, reaction *models.Reaction) error
Delete(ctx context.Context, id uuid.UUID) error
GetUserReactionForStory(ctx context.Context, storyID, userID uuid.UUID) (*models.Reaction, error)
GetReactionSummary(ctx context.Context, storyID uuid.UUID) (*models.ReactionSummary, error)
GetReactionStats(ctx context.Context, storyID uuid.UUID) (map[models.ReactionType]int, error)
}
ReactionStore defines the interface for reaction storage operations
func NewReactionStore ¶
func NewReactionStore(db *sqlx.DB, redisClient *RedisClient, logger *zap.Logger) ReactionStore
NewReactionStore creates a new reaction store
type ReactionStoreImpl ¶
type ReactionStoreImpl struct {
// contains filtered or unexported fields
}
ReactionStoreImpl implements ReactionStore interface
func (*ReactionStoreImpl) GetByStoryID ¶
func (s *ReactionStoreImpl) GetByStoryID(ctx context.Context, storyID uuid.UUID, limit, offset int) ([]*models.ReactionWithUser, error)
GetByStoryID gets reactions for a specific story
func (*ReactionStoreImpl) GetByUserID ¶
func (s *ReactionStoreImpl) GetByUserID(ctx context.Context, userID uuid.UUID, limit, offset int) ([]*models.Reaction, error)
GetByUserID gets reactions by a specific user
func (*ReactionStoreImpl) GetReactionStats ¶
func (s *ReactionStoreImpl) GetReactionStats(ctx context.Context, storyID uuid.UUID) (map[models.ReactionType]int, error)
GetReactionStats gets reaction statistics for a story
func (*ReactionStoreImpl) GetReactionSummary ¶
func (s *ReactionStoreImpl) GetReactionSummary(ctx context.Context, storyID uuid.UUID) (*models.ReactionSummary, error)
GetReactionSummary gets a summary of reactions for a story
func (*ReactionStoreImpl) GetUserReactionForStory ¶
func (s *ReactionStoreImpl) GetUserReactionForStory(ctx context.Context, storyID, userID uuid.UUID) (*models.Reaction, error)
GetUserReactionForStory gets a user's reaction for a specific story
type RedisClient ¶
type RedisClient struct {
// contains filtered or unexported fields
}
RedisClient wraps redis client with additional functionality
func NewRedisClient ¶
NewRedisClient creates a new Redis client
func (*RedisClient) Delete ¶
func (r *RedisClient) Delete(ctx context.Context, key string) error
Delete removes a key from Redis
func (*RedisClient) DeleteMany ¶
func (r *RedisClient) DeleteMany(ctx context.Context, keys []string) error
DeleteMany deletes multiple keys
func (*RedisClient) Eval ¶
func (r *RedisClient) Eval(ctx context.Context, script string, keys []string, args ...interface{}) *redis.Cmd
Eval executes a Lua script
func (*RedisClient) EvalSha ¶
func (r *RedisClient) EvalSha(ctx context.Context, sha1 string, keys []string, args ...interface{}) *redis.Cmd
EvalSha executes a Lua script by SHA
func (*RedisClient) FlushAll ¶
func (r *RedisClient) FlushAll(ctx context.Context) error
FlushAll flushes all keys
func (*RedisClient) Get ¶
func (r *RedisClient) Get(ctx context.Context, key string, dest interface{}) error
Get retrieves a value from Redis
func (*RedisClient) GetClient ¶
func (r *RedisClient) GetClient() *redis.Client
GetClient returns the underlying Redis client
func (*RedisClient) Health ¶
func (r *RedisClient) Health(ctx context.Context) error
Health checks Redis connection health
func (*RedisClient) Ping ¶
func (r *RedisClient) Ping(ctx context.Context) *redis.StatusCmd
Ping tests connectivity to Redis
func (*RedisClient) Pipeline ¶
func (r *RedisClient) Pipeline() redis.Pipeliner
Pipeline operations for batch processing
func (*RedisClient) ScriptExists ¶
func (r *RedisClient) ScriptExists(ctx context.Context, hashes ...string) *redis.BoolSliceCmd
ScriptExists checks if scripts exist
func (*RedisClient) ScriptFlush ¶
func (r *RedisClient) ScriptFlush(ctx context.Context) *redis.StatusCmd
ScriptFlush flushes all scripts
func (*RedisClient) ScriptKill ¶
func (r *RedisClient) ScriptKill(ctx context.Context) *redis.StatusCmd
ScriptKill kills a running script
func (*RedisClient) ScriptLoad ¶
ScriptLoad loads a script
type SearchFilters ¶
type SearchFilters struct {
Query string `json:"query"`
Filters map[string]string `json:"filters"`
SortBy string `json:"sort_by"`
SortOrder string `json:"sort_order"`
Limit int `json:"limit"`
Offset int `json:"offset"`
}
Search filters
type SessionStore ¶
type SessionStore interface {
Create(ctx context.Context, session *models.Session) error
GetByID(ctx context.Context, id uuid.UUID) (*models.Session, error)
GetByTokenID(ctx context.Context, tokenID string) (*models.Session, error)
GetByUserID(ctx context.Context, userID uuid.UUID) ([]*models.Session, error)
Update(ctx context.Context, session *models.Session) error
Delete(ctx context.Context, id uuid.UUID) error
DeleteExpired(ctx context.Context) error
DeleteByUserID(ctx context.Context, userID uuid.UUID) error
IsValidSession(ctx context.Context, tokenID string) (bool, error)
}
SessionStore defines the interface for session storage operations
type SqlDbStats ¶
type SqlDbStats struct {
OpenConnections int
InUse int
Idle int
WaitCount int64
WaitDuration time.Duration
MaxIdleClosed int64
MaxIdleTimeClosed int64
MaxLifetimeClosed int64
}
SqlDbStats represents database connection statistics
type StoreFactory ¶
type StoreFactory interface {
NewUserStore() UserStore
NewStoryStore() StoryStore
NewFollowStore() FollowStore
NewViewStore() ViewStore
NewReactionStore() ReactionStore
NewSessionStore() SessionStore
NewAnalyticsStore() AnalyticsStore
Close() error
}
Store factory interface
type StoryMetrics ¶
type StoryStore ¶
type StoryStore interface {
Create(ctx context.Context, story *models.Story) error
GetByID(ctx context.Context, id uuid.UUID) (*models.Story, error)
GetByAuthorID(ctx context.Context, authorID uuid.UUID, limit, offset int) ([]*models.Story, error)
GetFeed(ctx context.Context, userID uuid.UUID, limit, offset int) ([]*models.Story, error)
GetPublic(ctx context.Context, limit, offset int) ([]*models.Story, error)
Update(ctx context.Context, story *models.Story) error
Delete(ctx context.Context, id uuid.UUID) error
GetExpired(ctx context.Context, limit, offset int) ([]*models.Story, error)
IncrementViewCount(ctx context.Context, storyID uuid.UUID) error
GetViewCount(ctx context.Context, storyID uuid.UUID) (int, error)
}
StoryStore defines the interface for story storage operations
func NewStoryStore ¶
func NewStoryStore(db *sqlx.DB, redisClient *RedisClient, logger *zap.Logger) StoryStore
NewStoryStore creates a new story store
type StoryStoreImpl ¶
type StoryStoreImpl struct {
// contains filtered or unexported fields
}
StoryStoreImpl implements StoryStore interface
func (*StoryStoreImpl) GetByAuthorID ¶
func (s *StoryStoreImpl) GetByAuthorID(ctx context.Context, authorID uuid.UUID, limit, offset int) ([]*models.Story, error)
GetByAuthorID gets stories by author ID
func (*StoryStoreImpl) GetExpired ¶
func (s *StoryStoreImpl) GetExpired(ctx context.Context, limit, offset int) ([]*models.Story, error)
GetExpired gets expired stories
func (*StoryStoreImpl) GetFeed ¶
func (s *StoryStoreImpl) GetFeed(ctx context.Context, userID uuid.UUID, limit, offset int) ([]*models.Story, error)
GetFeed gets stories feed for a user
func (*StoryStoreImpl) GetViewCount ¶
GetViewCount gets view count for a story
func (*StoryStoreImpl) IncrementViewCount ¶
IncrementViewCount increments view count for a story
type TopStoryMetric ¶
type TopUserMetric ¶
type Transactional ¶
type Transactional interface {
WithTransaction(ctx context.Context, fn func(ctx context.Context) error) error
}
Transaction interface for database operations
type UserMetrics ¶
type UserStore ¶
type UserStore interface {
Create(ctx context.Context, user *models.User) error
GetByID(ctx context.Context, id uuid.UUID) (*models.User, error)
GetByEmail(ctx context.Context, email string) (*models.User, error)
GetByUsername(ctx context.Context, username string) (*models.User, error)
Update(ctx context.Context, user *models.User) error
Delete(ctx context.Context, id uuid.UUID) error
Search(ctx context.Context, query string, limit, offset int) ([]*models.User, error)
List(ctx context.Context, limit, offset int) ([]*models.User, error)
UpdateStats(ctx context.Context, userID uuid.UUID, stats models.UserStats) error
GetStats(ctx context.Context, userID uuid.UUID) (*models.UserStats, error)
}
UserStore defines the interface for user storage operations
func NewUserStore ¶
NewUserStore creates a new user store
type UserStoreImpl ¶
type UserStoreImpl struct {
// contains filtered or unexported fields
}
UserStoreImpl implements UserStore interface
func (*UserStoreImpl) GetByEmail ¶
GetByEmail gets a user by email
func (*UserStoreImpl) GetByUsername ¶
GetByUsername gets a user by username
func (*UserStoreImpl) Search ¶
func (s *UserStoreImpl) Search(ctx context.Context, query string, limit, offset int) ([]*models.User, error)
Search searches for users
func (*UserStoreImpl) UpdateStats ¶
func (s *UserStoreImpl) UpdateStats(ctx context.Context, userID uuid.UUID, stats models.UserStats) error
UpdateStats updates user statistics
type ViewStore ¶
type ViewStore interface {
Create(ctx context.Context, view *models.StoryView) error
GetByID(ctx context.Context, id uuid.UUID) (*models.StoryView, error)
GetByStoryID(ctx context.Context, storyID uuid.UUID, limit, offset int) ([]*models.StoryViewWithUser, error)
GetByViewerID(ctx context.Context, viewerID uuid.UUID, limit, offset int) ([]*models.StoryView, error)
GetViewStats(ctx context.Context, storyID uuid.UUID) (*models.StoryViewStats, error)
GetViewerStats(ctx context.Context, viewerID uuid.UUID) (*models.ViewerStats, error)
HasViewed(ctx context.Context, storyID, viewerID uuid.UUID) (bool, error)
GetViewAnalytics(ctx context.Context, storyID uuid.UUID, period string) (*models.ViewAnalytics, error)
GetViewTrends(ctx context.Context, storyID uuid.UUID) ([]*models.ViewTrend, error)
}
ViewStore defines the interface for story view storage operations
func NewViewStore ¶
NewViewStore creates a new view store
type ViewStoreImpl ¶
type ViewStoreImpl struct {
// contains filtered or unexported fields
}
ViewStoreImpl implements ViewStore interface
func (*ViewStoreImpl) GetByStoryID ¶
func (s *ViewStoreImpl) GetByStoryID(ctx context.Context, storyID uuid.UUID, limit, offset int) ([]*models.StoryViewWithUser, error)
GetByStoryID gets views for a specific story
func (*ViewStoreImpl) GetByViewerID ¶
func (s *ViewStoreImpl) GetByViewerID(ctx context.Context, viewerID uuid.UUID, limit, offset int) ([]*models.StoryView, error)
GetByViewerID gets views by a specific viewer
func (*ViewStoreImpl) GetViewAnalytics ¶
func (s *ViewStoreImpl) GetViewAnalytics(ctx context.Context, storyID uuid.UUID, period string) (*models.ViewAnalytics, error)
GetViewAnalytics gets analytics data for story views
func (*ViewStoreImpl) GetViewStats ¶
func (s *ViewStoreImpl) GetViewStats(ctx context.Context, storyID uuid.UUID) (*models.StoryViewStats, error)
GetViewStats gets view statistics for a story
func (*ViewStoreImpl) GetViewTrends ¶
func (s *ViewStoreImpl) GetViewTrends(ctx context.Context, storyID uuid.UUID) ([]*models.ViewTrend, error)
GetViewTrends gets view trend data over time - ADDED MISSING METHOD
func (*ViewStoreImpl) GetViewerStats ¶
func (s *ViewStoreImpl) GetViewerStats(ctx context.Context, viewerID uuid.UUID) (*models.ViewerStats, error)
GetViewerStats gets viewing statistics for a user