domain

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrCacheLocked is returned when cache file is already locked by another process
	ErrCacheLocked = errors.New("cache file is locked by another process")

	// ErrCacheCorrupted is returned when cache file is corrupted and cannot be read
	ErrCacheCorrupted = errors.New("cache file is corrupted")

	// ErrCachePermission is returned when there are permission issues with cache file or directory
	ErrCachePermission = errors.New("permission denied for cache file or directory")

	// ErrCacheDirectoryCreate is returned when cache directory cannot be created
	ErrCacheDirectoryCreate = errors.New("failed to create cache directory")
)

Cache-related errors

Functions

This section is empty.

Types

type ArticleSelector added in v0.0.7

type ArticleSelector interface {
	Select(ctx context.Context, articles []entity.Article) (*entity.Article, error)
}

ArticleSelector は複数の記事から1つを選択するインターフェース

type CommentGenerator

type CommentGenerator interface {
	Generate(context.Context, *entity.Article) (string, error)
}

CommentGenerator はAIを使用してコメントを生成するインターフェース

type CommentGeneratorFactory

type CommentGeneratorFactory interface {
	MakeCommentGenerator(*entity.AIConfig, *entity.PromptConfig) (CommentGenerator, error)
}

CommentGeneratorFactory はCommentGeneratorを生成するファクトリのインターフェース

type ConfigInitRepository added in v0.0.10

type ConfigInitRepository interface {
	// SaveWithTemplate はテンプレートを使用して設定ファイルを保存する
	SaveWithTemplate() error
}

ConfigInitRepository は設定ファイルの初期化を担当するインターフェース

type ConfigRepository added in v0.0.10

type ConfigRepository interface {
	// Load は設定ファイルを読み込む
	Load() (*LoadedConfig, error)
}

ConfigRepository は設定ファイルの読み込みを担当するインターフェース

type ConfigSummary added in v0.0.7

type ConfigSummary struct {
	// GeminiConfigured はGemini APIの設定状態
	GeminiConfigured bool
	// GeminiModel は設定されているGeminiモデル
	GeminiModel string
	// SystemPromptConfigured はシステムプロンプトの設定状態
	SystemPromptConfigured bool
	// CommentPromptConfigured はコメントプロンプトの設定状態
	CommentPromptConfigured bool
	// FixedMessageConfigured は固定メッセージの設定状態
	FixedMessageConfigured bool
	// SlackConfigured はSlack APIの設定状態
	SlackConfigured bool
	// SlackChannel はSlackチャンネル
	SlackChannel string
	// SlackMessageTemplateConfigured はSlackメッセージテンプレートの設定状態
	SlackMessageTemplateConfigured bool
	// MisskeyConfigured はMisskeyの設定状態
	MisskeyConfigured bool
	// MisskeyAPIURL はMisskey API URL
	MisskeyAPIURL string
	// MisskeyMessageTemplateConfigured はMisskeyメッセージテンプレートの設定状態
	MisskeyMessageTemplateConfigured bool
	// CacheEnabled はキャッシュの有効/無効
	CacheEnabled bool
	// CacheFilePath はキャッシュファイルのパス
	CacheFilePath string
	// CacheMaxEntries はキャッシュの最大エントリ数
	CacheMaxEntries int
	// CacheRetentionDays はキャッシュの保持期間(日数)
	CacheRetentionDays int
}

ConfigSummary は設定のサマリー情報を表す(verbose用)

type ErrorCallback

type ErrorCallback func(string, error) error

type FetchClient

type FetchClient interface {
	Fetch(url string) ([]entity.Article, error)
}

type Fetcher

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

func NewFetcher

func NewFetcher(client FetchClient, errorCallback ErrorCallback) *Fetcher

func (*Fetcher) Fetch

func (f *Fetcher) Fetch(urls []string, limit int) ([]entity.Article, error)

type FirstRecommender

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

func (*FirstRecommender) Recommend

func (r *FirstRecommender) Recommend(ctx context.Context, articles []entity.Article) (*entity.Recommend, error)

type LoadedConfig added in v0.0.10

type LoadedConfig struct {
	// DefaultProfile はデフォルトプロファイル設定
	DefaultProfile *entity.Profile
	// Cache はキャッシュ設定
	Cache *entity.CacheConfig
}

LoadedConfig は読み込まれた設定を表す構造体

type MessageSender added in v0.0.3

type MessageSender interface {
	// SendRecommend は推薦記事を送信する
	SendRecommend(*entity.Recommend, string) error
	// ServiceName はサービス名を返す(ログ表示用)
	ServiceName() string
}

MessageSender はメッセージ送信を行うインターフェース

type ProfileRepository added in v0.0.3

type ProfileRepository interface {
	LoadProfile() (*entity.Profile, error)
}

ProfileRepository はプロファイルの読み込みを担当するインターフェース

type ProfileTemplateRepository added in v0.0.10

type ProfileTemplateRepository interface {
	SaveProfileTemplate() error
}

ProfileTemplateRepository はプロファイルテンプレートの保存を担当するインターフェース

type RecommendCache added in v0.0.5

type RecommendCache interface {
	// Initialize initializes the cache, loads existing data and acquires necessary locks
	Initialize() error

	// IsCached checks if the given URL is already cached (duplicate check)
	IsCached(url string) bool

	// AddEntry adds a new entry to the cache with the given URL and title
	AddEntry(url, title string) error

	// Close closes the cache, releases locks and performs cleanup
	Close() error
}

RecommendCache provides an interface for managing recommend article cache

type RecommendEntry added in v0.0.5

type RecommendEntry struct {
	URL      string    `json:"url"`
	Title    string    `json:"title"`
	PostedAt time.Time `json:"posted_at"`
}

RecommendEntry represents a single cache entry for recommended articles

type Recommender

type Recommender interface {
	Recommend(context.Context, []entity.Article) (*entity.Recommend, error)
}

func NewSelectorBasedRecommender added in v0.0.7

func NewSelectorBasedRecommender(
	selector ArticleSelector,
	factory CommentGeneratorFactory,
	ai *entity.AIConfig,
	prompt *entity.PromptConfig,
) Recommender

NewSelectorBasedRecommender は新しいSelectorBasedRecommenderを作成する

type SelectorBasedRecommender added in v0.0.7

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

SelectorBasedRecommender は ArticleSelector を使用して記事を選択するRecommender

func (*SelectorBasedRecommender) Recommend added in v0.0.7

func (r *SelectorBasedRecommender) Recommend(ctx context.Context, articles []entity.Article) (*entity.Recommend, error)

type ValidationError added in v0.0.7

type ValidationError struct {
	// Field はエラーが発生したフィールド名
	Field string
	// Type はエラーの種別
	Type ValidationErrorType
	// Message は詳細なエラーメッセージ
	Message string
}

ValidationError はバリデーションエラーの詳細を表す

type ValidationErrorType added in v0.0.7

type ValidationErrorType int

ValidationErrorType はバリデーションエラーの種別を表す

const (
	// ValidationErrorTypeRequired は必須項目が未設定のエラー
	ValidationErrorTypeRequired ValidationErrorType = iota
	// ValidationErrorTypeDummyValue はダミー値が設定されているエラー
	ValidationErrorTypeDummyValue
	// ValidationErrorTypeInvalid は不正な値が設定されているエラー
	ValidationErrorTypeInvalid
)

type ValidationResult added in v0.0.7

type ValidationResult struct {
	// Valid はバリデーションが成功したかどうか
	Valid bool
	// Errors はバリデーションエラーのリスト
	Errors []ValidationError
	// Summary は設定のサマリー情報
	Summary ConfigSummary
}

ValidationResult はバリデーション結果を表す

type Validator added in v0.0.7

type Validator interface {
	Validate() (*ValidationResult, error)
}

Validator は設定のバリデーションを担当するインターフェース

type ValidatorFactory added in v0.0.10

type ValidatorFactory interface {
	// Create はバリデーターを作成する
	Create(config *LoadedConfig, profile *entity.Profile) Validator
}

ValidatorFactory は設定のバリデーターを作成するファクトリインターフェース

Directories

Path Synopsis
Package mock_domain is a generated GoMock package.
Package mock_domain is a generated GoMock package.

Jump to

Keyboard shortcuts

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