The repo is a dependency of MYDICTIONARY which version is <= v3.0.0.
The repository defines some basic data structures of MYDICTIONARY ("the core library" for short).
Take file animal.xlsx as an example.
If the word is exactly the same as the content in cell at column "Word" in a line, data of the line will be selected.
For example, in basic query, input word "cat" and data of the line 1 will be selected.
If the word is contained by the content in cells at columns "Word", "Definition" or "Note" in a line, the line will be selected.
For example, in advanced query, input word "e" and the data of line 1, 3 and 5 will be selected.
type VocabularyAskStruct struct {
Word string `json:"word"`
Advance bool `json:"advance"`
Online bool `json:"online"`
DoNotRecord bool `json:"doNotRecord"`
}This structure indicates the word and options of query.
Word indicates the word for query.
If Advance is false, the core library will do basic query of Word only.
If Advance is true, the core library will do both basic query and advanced query of Word.
If Online is true, the core library will know that users need query Word online.
Note that it doesn't ensure that the core library will query Word online. Whether the core library does also depends on online.mode in configuration (at here).
If DoNotRecord is true, the core library will not record the vocabulary to any collections and dictionaries.
const (
Basic = "basic"
Advance = "advance"
Collection = 1
Dictionary = 2
Online = 3
)
type VocabularyAnswerStruct struct {
Word string `json:"word"` // `xlsx:wd`
Definition []string `json:"definition"` // `xlsx:def`
SerialNumber int `json:"serialNumber"` // `xlsx:sn`
QueryCounter int `json:"queryCounter"` // `xlsx:qc`
QueryTime string `json:"queryTime"` // `xlsx:qt`
Note []string `json:"note"` // `xlsx:nt`
SourceName string `json:"sourceName"`
Status string `json:"status"`
Location LocationStruct `json:"location"`
}
type LocationStruct struct {
TableType int `json:"tableType"`
TableIndex int `json:"tableIndex"`
ItemIndex int `json:"itemIndex"`
}This is the data structure of the vocabulary.
Word indicates the word in the vocabulary.
Definition indicates definitions in the vocabulary.
SerialNumber indicates the serial number of the vocabulary.
QueryCounter indicates the query counter of the vocabulary.
Note indicates notes in the vocabulary.
QueryTime indicates the last query time of the vocabulary.
SourceName indicates where the vocabulary comes from. It can be the name of:
- the collection
- the dictionary
- the service
Status indicates some other information.
If the vocabulary comes from the collection or the dictionary:
- If the vocabulary comes from basic query, its
Statuswill beBasic. - If the vocabulary comes from advanced query, its
Statuswill beAdvance.
If the vocabulary comes from the service, its Status will be Basic.
Location is used to locate the vocabulary in collections or dictionaries.
It is a structure and has got these members:
TableTypeindicates the source of the vocabulary.- If the vocabulary comes from the collection, it will be
Collection. - If the vocabulary comes from the dictionary, it will be
Dictionary. - If the vocabulary comes from the service, it will be
Online.
- If the vocabulary comes from the collection, it will be
TableIndexindicates the index of the collection or the dictionary (depends onTableType) which the vocabulary belongs to in the list.ItemIndexindicates the vocabulary's index in the collection or the dictionary.
These indexes begin with 0.
type VocabularyResultStruct struct {
Basic []vocabulary4mydictionary.VocabularyAnswerStruct `json:"basic"`
Advance []vocabulary4mydictionary.VocabularyAnswerStruct `json:"advance"`
}Basic is made up by vocabularies come from basic query.
Advance is made up by vocabularies come from advanced query.
type VocabularyEditStruct struct {
Location LocationStruct `json:"location"`
Definition string `json:"definition"`
Note string `json:"note"`
}This structure is used to provide information for editting a vocabulary in collection or dictionary.
Location is same as #4.9.
Definition indicates amended definitions.
Note indicates amended notes.
- All code files are edited by Atom.
- All ".md" files are edited by Typora.
- The style of all ".md" files is Github Flavored Markdown.
- There is a LF (Linux) at the end of each line.
