Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Definition ¶
type Definition struct { ID DefinitionID `gorm:"primaryKey;autoIncrement;not null"` WordID WordID `gorm:"not null"` Type sueno.WordType `gorm:"not null"` Definition string `gorm:"not null;default:''"` Translation string `gorm:"not null"` Example string `gorm:"not null;default:''"` ExampleTranslation string `gorm:"not null;default:''"` }
type DefinitionID ¶
type DefinitionID uint64
func ParseDefinitionID ¶
func ParseDefinitionID(s string) (DefinitionID, error)
type Repository ¶
type Repository interface { // WordRoot returns the words associated with the given root, sorted // by [Word.Type] and then by name. WordRoot(ctx context.Context, root string) (*WordRoot, error) CreateWord(context.Context, Word) (WordID, error) Word(context.Context, WordID) (*Word, error) SearchWord(context.Context, string) (*Word, error) SearchTranslation(context.Context, string) ([]TranslatedWord, error) CompoundWordsContaining(context.Context, WordID) ([]Word, error) DeleteWord(context.Context, WordID) error }
type TranslatedWord ¶
type TranslatedWord struct { Word MatchedDefinition Definition `gorm:"-"` }
type Word ¶
type Word struct { ID WordID `gorm:"primaryKey;autoIncrement;not null"` Word string `gorm:"not null;unique"` Root string `gorm:"not null;default:''"` // CustomPlural allows overriding the plural form of the word. // // If this is empty, the plural form is grammatically derived from the word. // // Used for words such as 'ja' (plural: 'jaos'). CustomPlural string `gorm:"not null;default:''"` Definitions []Definition `gorm:"foreignKey:WordID;references:ID;constraint:OnDelete:cascade"` CompoundWords []Word `gorm:"-"` }
Click to show internal directories.
Click to hide internal directories.