Documentation
¶
Overview ¶
Package utils is intended to provide some useful functions
Package utils is intended to provide some useful functions ¶
Package utils is intended to provide some useful functions ¶
Package utils is intended to provide some useful functions
Index ¶
- func CommitRepository() error
- func GetBundleVersion() (string, error)
- func GetGitAuth() (transport.AuthMethod, error)
- func GetMillionSecondTimestamp() int64
- func Push() error
- func ReleaseRepository() error
- func SyncRepository() error
- type CategoryUnit
- type CategoryUnitCollection
- type SentencesUnit
- type SentencesUnitCollection
- type VersionData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CommitRepository ¶
func CommitRepository() error
CommitRepository will commit all local changes
func GetBundleVersion ¶
GetBundleVersion Get bundle version by reading version lockfile
func GetGitAuth ¶
func GetGitAuth() (transport.AuthMethod, error)
GetGitAuth will return transport.AuthMethod interface by driver that configure in config file
func GetMillionSecondTimestamp ¶
func GetMillionSecondTimestamp() int64
GetMillionSecondTimestamp will return current timestamp (ms)
func SyncRepository ¶
func SyncRepository() error
SyncRepository will force sync local repository correspond to remote repository
Types ¶
type CategoryUnit ¶
CategoryUnit is unit of category collection, stored in categories.json file
type CategoryUnitCollection ¶
type CategoryUnitCollection []CategoryUnit
CategoryUnitCollection is collection of category unit
func DeepCopyCategoryUnitCollection ¶
func DeepCopyCategoryUnitCollection(collection CategoryUnitCollection) CategoryUnitCollection
DeepCopyCategoryUnitCollection deep copy from source
func (*CategoryUnitCollection) ImportFrom ¶
func (p *CategoryUnitCollection) ImportFrom(c []database.Category)
ImportFrom can convert []category to []categoryUnit
type SentencesUnit ¶
type SentencesUnit struct { Name string `json:"name"` Key string `json:"key"` Path string `json:"path"` Timestamp int64 `json:"timestamp"` }
SentencesUnit is a unit of VersionData SentencesUnitCollection
type SentencesUnitCollection ¶
type SentencesUnitCollection []SentencesUnit
SentencesUnitCollection is a collection of SentencesUnit
func DeepCopySentencesUnitCollection ¶
func DeepCopySentencesUnitCollection(s SentencesUnitCollection) SentencesUnitCollection
DeepCopySentencesUnitCollection deep copy from source
func (*SentencesUnitCollection) Find ¶
func (c *SentencesUnitCollection) Find(key string) (*SentencesUnit, bool)
Find will return specific SentencesUnit Pointer
func (*SentencesUnitCollection) Update ¶
func (c *SentencesUnitCollection) Update(key string) error
Update will update the timestamp of specific SentencesUnit
type VersionData ¶
type VersionData struct { ProtocolVersion string `json:"protocol_version"` BundleVersion string `json:"bundle_version"` UpdatedAt int64 `json:"updated_at"` Categories struct { Path string `json:"path"` Timestamp int64 `json:"timestamp"` } `json:"categories"` Sentences SentencesUnitCollection `json:"sentences"` }
VersionData is the structure of version lockfile
func DeepCopyVersionData ¶
func DeepCopyVersionData(data VersionData) VersionData
DeepCopyVersionData deep copy from source
func (*VersionData) StepVersion ¶
func (v *VersionData) StepVersion() error
StepVersion will increase patch version
func (*VersionData) UpdateCategoriesRecord ¶
func (v *VersionData) UpdateCategoriesRecord(categoriesData CategoryUnitCollection)
UpdateCategoriesRecord will update timestamp in categories field and updated_at field
func (*VersionData) UpdateSentenceRecord ¶
func (v *VersionData) UpdateSentenceRecord(categoryKey string) error
UpdateSentenceRecord will update timestamp in specific category of sentences field and updated_at field