Documentation
¶
Index ¶
Constants ¶
const WordTypeLemma = "lemma"
Variables ¶
var ( ErrUserNotFound = errors.New("user not found") ErrInvalidUserName = errors.New("invalid user name") ErrInvalidUserEmail = errors.New("invalid user email") ErrUserAlreadyExists = errors.New("user already exists") ErrInvalidUserID = errors.New("invalid user ID") ErrUserWordNotFound = errors.New("user word not found") ErrDuplicateUserWord = errors.New("user word already exists") ErrInvalidUserWordText = errors.New("invalid user word text") ErrVocNotFound = errors.New("word not found") ErrInvalidVocID = errors.New("invalid word id") ErrInvalidVocText = errors.New("invalid word text") ErrDuplicateWord = errors.New("word already exists") )
Domain errors for user entity and related aggregates.
Functions ¶
This section is empty.
Types ¶
type Language ¶
type Language string
Language represents supported language codes using ISO-style abbreviations.
func NormalizeLanguage ¶
NormalizeLanguage ensures the language falls back to a supported value (defaults to English).
func ParseLanguage ¶
ParseLanguage converts an arbitrary string into a supported Language value.
func (Language) CodeOrDefault ¶
CodeOrDefault returns the language code, falling back to English when unspecified.
type MasteryBreakdown ¶
MasteryBreakdown captures skill-specific mastery scores for a user word.
type ReviewTiming ¶
type ReviewTiming struct {
LastReviewAt time.Time
NextReviewAt time.Time
IntervalDays int32
FailCount int32
}
ReviewTiming represents spaced repetition metadata for a user word.
type Sentence ¶
type Sentence struct {
Text string `json:"text"`
Source int32 `json:"source"`
SourceRef string `json:"source_ref,omitempty"`
}
Sentence captures a short contextual example recorded by the user.
type User ¶
type User struct {
ID int64 `json:"id"`
Name string `json:"name"`
Email string `json:"email"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
User represents a user entity in the domain
type UserWord ¶
type UserWord struct {
ID int64
UserID int64
Word string
Language Language
Mastery MasteryBreakdown
Review ReviewTiming
QueryCount int64
Notes string
Sentences []Sentence
Relations []UserWordRelation
CreatedBy string
CreatedAt time.Time
UpdatedAt time.Time
}
UserWord represents a user's personalised vocabulary entry.
type UserWordRelation ¶
type UserWordRelation struct {
Word string `json:"word"`
RelationType int32 `json:"relation_type"`
Note string `json:"note,omitempty"`
CreatedBy string `json:"created_by"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
UserWordRelation links a user word to another concept in their vocabulary graph.
type Word ¶
type Word struct {
ID int64
Text string
Language Language
WordType string // lemma, past, pp (past participle), ing (present participle), 3sg (third person singular), plural, comparative, superlative, variant, derived, other
Lemma *string // nil if this row itself is the lemma
Phonetics []WordPhonetic
Definitions []WordDefinition // only populated for lemma rows
Tags []string
Phrases []Phrase
Sentences []Sentence
Forms []WordFormRef // if this is lemma: other forms; if not lemma: empty
Relations []WordRelation
CreatedAt time.Time
UpdatedAt time.Time
}
type WordDefinition ¶
type WordFormRef ¶
type WordPhonetic ¶
type WordRelation ¶
WordRelation models a connection to another dictionary entry.