storage

package
v0.0.0-...-5aad56d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 1, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchCreateSourcesInput

type BatchCreateSourcesInput struct {
	Sources []CreateSourceInput `json:"sources"`
}

BatchCreateSourcesInput represents the input for batch creating RSS sources

type BatchCreateSourcesResult

type BatchCreateSourcesResult struct {
	Sources []RSSSource  `json:"sources"`
	Errors  []BatchError `json:"errors"`
}

BatchCreateSourcesResult represents the result of batch creating RSS sources

type BatchDeleteContentsInput

type BatchDeleteContentsInput struct {
	ContentIDs []string `json:"contentIds"`
}

BatchDeleteContentsInput represents the input for batch deleting RSS content items

type BatchDeleteContentsResult

type BatchDeleteContentsResult struct {
	DeletedCount int          `json:"deletedCount"`
	Errors       []BatchError `json:"errors"`
}

BatchDeleteContentsResult represents the result of batch deleting RSS content items

type BatchDeleteSourcesInput

type BatchDeleteSourcesInput struct {
	SourceIDs []string `json:"sourceIds"`
}

BatchDeleteSourcesInput represents the input for batch deleting RSS sources

type BatchDeleteSourcesResult

type BatchDeleteSourcesResult struct {
	DeletedCount int          `json:"deletedCount"`
	Errors       []BatchError `json:"errors"`
}

BatchDeleteSourcesResult represents the result of batch deleting RSS sources

type BatchError

type BatchError struct {
	Index     int    `json:"index,omitempty"`
	SourceID  string `json:"sourceId,omitempty"`
	ErrorType string `json:"errorType"`
	Message   string `json:"message"`
}

BatchError represents an error in a batch operation

type CreateRecommendationFeedbackInput

type CreateRecommendationFeedbackInput struct {
	ContentID string `json:"contentId"`
	UserID    string `json:"userId"`
	Rating    int    `json:"rating"`
	Comment   string `json:"comment,omitempty"`
}

CreateRecommendationFeedbackInput represents the input for creating recommendation feedback

type CreateSourceInput

type CreateSourceInput struct {
	Name        string `json:"name"`
	URL         string `json:"url"`
	Description string `json:"description"`
}

CreateSourceInput represents the input for creating an RSS source

type FetchJob

type FetchJob struct {
	ID             string     `json:"jobId"`
	Status         string     `json:"status"`
	StartedAt      time.Time  `json:"startedAt"`
	CompletedAt    *time.Time `json:"completedAt,omitempty"`
	ItemsProcessed int        `json:"itemsProcessed"`
	SourceID       *string    `json:"sourceId,omitempty"`
	Days           int        `json:"days"`
	Errors         []string   `json:"errors,omitempty"`
}

FetchJob represents an RSS content fetch job

type GetRecommendationsInput

type GetRecommendationsInput struct {
	UserID    string   `json:"userId,omitempty"`
	SourceIDs []string `json:"sourceIds,omitempty"`
	Limit     int      `json:"limit"`
}

GetRecommendationsInput represents the input for getting recommendations

type RSSContent

type RSSContent struct {
	ID          string     `json:"id"`
	SourceID    string     `json:"sourceId"`
	Title       string     `json:"title"`
	Link        string     `json:"link"`
	Description string     `json:"description"`
	Content     string     `json:"content,omitempty"`
	PublishedAt time.Time  `json:"publishedAt"`
	FetchedAt   time.Time  `json:"fetchedAt"`
	UpdatedAt   *time.Time `json:"updatedAt,omitempty"`
	Author      string     `json:"author,omitempty"`
	Categories  []string   `json:"categories,omitempty"`
}

RSSContent represents an RSS content item

type RSSSource

type RSSSource struct {
	ID            string     `json:"id"`
	Name          string     `json:"name"`
	URL           string     `json:"url"`
	Description   string     `json:"description"`
	CreatedAt     time.Time  `json:"createdAt"`
	UpdatedAt     time.Time  `json:"updatedAt"`
	LastFetchedAt *time.Time `json:"lastFetchedAt,omitempty"`
}

RSSSource represents an RSS source

type RecommendationFeedback

type RecommendationFeedback struct {
	ID        string    `json:"id"`
	ContentID string    `json:"contentId"`
	UserID    string    `json:"userId"`
	Rating    int       `json:"rating"` // 1-5 scale
	Timestamp time.Time `json:"timestamp"`
	Comment   string    `json:"comment,omitempty"`
}

RecommendationFeedback represents user feedback on a recommended content item

type RecommendationResult

type RecommendationResult struct {
	Content      RSSContent `json:"content"`
	Score        float64    `json:"score"`
	RecommendFor string     `json:"recommendFor,omitempty"`
}

RecommendationResult represents a recommended content item with its score

type SQLiteDB

type SQLiteDB struct {
	// contains filtered or unexported fields
}

SQLiteDB represents a SQLite database connection

func NewSQLiteDB

func NewSQLiteDB(dbPath string) (*SQLiteDB, error)

NewSQLiteDB creates a new SQLite database connection

func (*SQLiteDB) BatchCreateSources

func (s *SQLiteDB) BatchCreateSources(input BatchCreateSourcesInput) (*BatchCreateSourcesResult, error)

BatchCreateSources creates multiple RSS sources

func (*SQLiteDB) BatchDeleteContents

func (s *SQLiteDB) BatchDeleteContents(input BatchDeleteContentsInput) (*BatchDeleteContentsResult, error)

BatchDeleteContents deletes multiple RSS content items

func (*SQLiteDB) BatchDeleteSources

func (s *SQLiteDB) BatchDeleteSources(input BatchDeleteSourcesInput) (*BatchDeleteSourcesResult, error)

BatchDeleteSources deletes multiple RSS sources

func (*SQLiteDB) Close

func (s *SQLiteDB) Close() error

Close closes the database connection

func (*SQLiteDB) CreateContent

func (s *SQLiteDB) CreateContent(content *RSSContent) error

CreateContent creates a new RSS content item

func (*SQLiteDB) CreateFetchJob

func (s *SQLiteDB) CreateFetchJob(sourceID *string, days int) (*FetchJob, error)

CreateFetchJob creates a new fetch job

func (*SQLiteDB) CreateRecommendationFeedback

func (s *SQLiteDB) CreateRecommendationFeedback(input CreateRecommendationFeedbackInput) (*RecommendationFeedback, error)

CreateRecommendationFeedback creates a new recommendation feedback entry

func (*SQLiteDB) CreateSource

func (s *SQLiteDB) CreateSource(input CreateSourceInput) (*RSSSource, error)

CreateSource creates a new RSS source

func (*SQLiteDB) DeleteContent

func (s *SQLiteDB) DeleteContent(id string) error

DeleteContent deletes an RSS content item

func (*SQLiteDB) DeleteSource

func (s *SQLiteDB) DeleteSource(id string) error

DeleteSource deletes an RSS source

func (*SQLiteDB) GetContent

func (s *SQLiteDB) GetContent(id string) (*RSSContent, error)

GetContent retrieves an RSS content item by ID

func (*SQLiteDB) GetContentByURL

func (s *SQLiteDB) GetContentByURL(url string) (*RSSContent, error)

GetContentByURL retrieves an RSS content item by URL

func (*SQLiteDB) GetFetchJob

func (s *SQLiteDB) GetFetchJob(id string) (*FetchJob, error)

GetFetchJob retrieves a fetch job by ID

func (*SQLiteDB) GetRecommendations

func (s *SQLiteDB) GetRecommendations(input GetRecommendationsInput) ([]RecommendationResult, error)

GetRecommendations retrieves recommended content items

func (*SQLiteDB) GetSource

func (s *SQLiteDB) GetSource(id string) (*RSSSource, error)

GetSource retrieves an RSS source by ID

func (*SQLiteDB) GetUserFeedback

func (s *SQLiteDB) GetUserFeedback(userID string) ([]RecommendationFeedback, error)

GetUserFeedback retrieves all feedback given by a user

func (*SQLiteDB) ListContents

func (s *SQLiteDB) ListContents(sourceID string, startDate, endDate time.Time, limit int, nextToken string) ([]RSSContent, string, error)

ListContents lists RSS content items with filtering and pagination

func (*SQLiteDB) ListSources

func (s *SQLiteDB) ListSources(limit int, nextToken string) ([]RSSSource, string, error)

ListSources lists RSS sources with pagination

func (*SQLiteDB) SearchContents

func (s *SQLiteDB) SearchContents(keywords string, sourceID string, limit int) ([]RSSContent, error)

SearchContents searches for RSS content items by keywords

func (*SQLiteDB) UpdateContent

func (s *SQLiteDB) UpdateContent(id string, input UpdateContentInput) (*RSSContent, error)

UpdateContent updates an RSS content item

func (*SQLiteDB) UpdateFetchJobStatus

func (s *SQLiteDB) UpdateFetchJobStatus(id string, status string, itemsProcessed int, errorMsg string) error

UpdateFetchJobStatus updates the status of a fetch job

func (*SQLiteDB) UpdateSource

func (s *SQLiteDB) UpdateSource(id string, input UpdateSourceInput) (*RSSSource, error)

UpdateSource updates an RSS source

func (*SQLiteDB) UpdateSourceLastFetchedAt

func (s *SQLiteDB) UpdateSourceLastFetchedAt(id string, lastFetchedAt time.Time) error

UpdateSourceLastFetchedAt updates the last_fetched_at field of an RSS source

type UpdateContentInput

type UpdateContentInput struct {
	Title       string   `json:"title"`
	Description string   `json:"description"`
	Content     string   `json:"content"`
	Categories  []string `json:"categories"`
}

UpdateContentInput represents the input for updating an RSS content item

type UpdateSourceInput

type UpdateSourceInput struct {
	Name        string `json:"name"`
	URL         string `json:"url"`
	Description string `json:"description"`
}

UpdateSourceInput represents the input for updating an RSS source

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL