model

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const TableNamePhrase = "phrase"
View Source
const TableNameWord = "word"
View Source
const TableNameWordPhrase = "word_phrase"

Variables

This section is empty.

Functions

This section is empty.

Types

type Phrase

type Phrase struct {
	PhraseID   string `gorm:"column:phrase_id;type:TEXT" json:"phrase_id"`
	Phrase     string `gorm:"column:phrase;type:TEXT" json:"phrase"`
	CreateTime int64  `gorm:"column:create_time;type:BIGINT" json:"create_time"`
	UpdateTime int64  `gorm:"column:update_time;type:BIGINT" json:"update_time"`
}

Phrase mapped from table <phrase>

func NewPhrase

func NewPhrase(phrase string) *Phrase

func (*Phrase) TableName

func (*Phrase) TableName() string

TableName Phrase's table name

type Word

type Word struct {
	WordID         string `gorm:"column:word_id;primaryKey" json:"word_id"`
	Word           string `gorm:"column:word;not null" json:"word"`
	Phonetic       string `gorm:"column:phonetic;not null" json:"phonetic"`
	Definition     string `gorm:"column:definition;not null" json:"definition"`
	Difficulty     string `gorm:"column:difficulty;not null" json:"difficulty"`
	LastUsed       int64  `gorm:"column:last_used;not null" json:"last_used"`
	NumRepetitions int32  `gorm:"column:num_repetitions;not null" json:"num_repetitions"`
	CreateTime     int64  `gorm:"column:create_time;not null" json:"create_time"`
	UpdateTime     int64  `gorm:"column:update_time;not null" json:"update_time"`
}

Word mapped from table <word>

func NewWord

func NewWord(word string) *Word

func (*Word) SetDefinition

func (word *Word) SetDefinition(definition string)

func (*Word) SetPhonetic

func (word *Word) SetPhonetic(phonetic string)

func (*Word) TableName

func (*Word) TableName() string

TableName Word's table name

type WordPhrase

type WordPhrase struct {
	WordPhraseID string `gorm:"column:word_phrase_id;type:TEXT" json:"word_phrase_id"`
	WordID       string `gorm:"column:word_id;type:TEXT" json:"word_id"`
	PhraseID     string `gorm:"column:phrase_id;type:TEXT" json:"phrase_id"`
	CreateTime   int64  `gorm:"column:create_time;type:BIGINT" json:"create_time"`
	UpdateTime   int64  `gorm:"column:update_time;type:BIGINT" json:"update_time"`
}

WordPhrase mapped from table <word_phrase>

func NewWordPhrase

func NewWordPhrase(wordId, phraseId string) *WordPhrase

func (*WordPhrase) TableName

func (*WordPhrase) TableName() string

TableName WordPhrase's table name

type Words

type Words []*Word

func (Words) GenerateWordPhrase

func (words Words) GenerateWordPhrase(phraseId string) (list []*WordPhrase)

func (Words) List

func (words Words) List() (items []string)

func (Words) ListByLetter

func (words Words) ListByLetter() map[string]Words

func (Words) RandomPick

func (words Words) RandomPick() *Word

func (Words) WordIds

func (words Words) WordIds() (items []string)

Jump to

Keyboard shortcuts

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