Documentation ¶
Index ¶
- func GetArchive() (map[string]map[string][]*ShowArchive, []string, map[string][]string, error)
- func GetPageIDBySlug(slug string) uint64
- func GetSubjectArticleList(subjectID uint64) ([]*map[string]interface{}, error)
- func NewServiceEngine() error
- type ChildrenSubjectsResult
- type Engine
- func (svc *Engine) GetCache(key string) ([]byte, bool)
- func (svc *Engine) GetKnowledgeBySlug(kType, kSlug string) (*ShowKnowledgeInfo, error)
- func (svc *Engine) GetKnowledgeItemContentBySymbol(kiSymbol string) (*ShowKnowledgeItemContent, error)
- func (svc *Engine) GetKnowledgeItemList(kType, kSlug string, kID uint64) ([]*ShowKnowledgeItemTreeNode, error)
- func (svc *Engine) GetKnowledgeList() (map[string]map[uint64]*ShowKnowledgeList, error)
- func (svc *Engine) JSONUnmarshal(data []byte, v interface{})
- func (svc *Engine) MarshalAndSetCache(key string, v interface{})
- func (svc *Engine) SetCache(key string, value []byte) error
- type KnowledgeList
- type List
- type ShowArchive
- type ShowArticle
- type ShowArticleDetail
- type ShowCategory
- type ShowKnowledgeInfo
- type ShowKnowledgeItemContent
- type ShowKnowledgeItemTreeNode
- type ShowKnowledgeList
- type ShowLastOrNextArticle
- type ShowPageDetail
- type ShowSubjectInfo
- type ShowSubjectList
- type ShowTag
- type ShowWidgetCategoryTreeNode
- type ShowWidgetLatestArticles
- type SubjectInfoResult
- type SubjectList
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetArchive ¶
GetArchive get archive list and list sort
func GetSubjectArticleList ¶
GetSubjectArticleList get article list connected to subject
func NewServiceEngine ¶ added in v0.4.1
func NewServiceEngine() error
NewServiceEngine return a new Service engine for frontend web this method will only be called once at the beginning for initialization
Types ¶
type ChildrenSubjectsResult ¶ added in v0.4.0
type ChildrenSubjectsResult struct { ID uint64 ParentID uint64 Name string Slug string Description string CoverImageURL string Count uint64 LastUpdated sql.NullTime }
ChildrenSubjectsResult use for scan
type Engine ¶ added in v0.4.0
type Engine struct { Cache *cache.Cache JSON jsoniter.API // contains filtered or unexported fields }
Engine service engine
var SrvEngine *Engine
SrvEngine service engine instance
func (*Engine) GetKnowledgeBySlug ¶ added in v0.4.1
func (svc *Engine) GetKnowledgeBySlug(kType, kSlug string) (*ShowKnowledgeInfo, error)
GetKnowledgeBySlug get knowledge by slug
func (*Engine) GetKnowledgeItemContentBySymbol ¶ added in v0.4.1
func (svc *Engine) GetKnowledgeItemContentBySymbol(kiSymbol string) (*ShowKnowledgeItemContent, error)
GetKnowledgeItemContentBySymbol get knowledge item content by knowledge item symbol
func (*Engine) GetKnowledgeItemList ¶ added in v0.4.1
func (svc *Engine) GetKnowledgeItemList(kType, kSlug string, kID uint64) ([]*ShowKnowledgeItemTreeNode, error)
GetKnowledgeItemList get knowledge item list in tree
func (*Engine) GetKnowledgeList ¶ added in v0.4.1
func (svc *Engine) GetKnowledgeList() (map[string]map[uint64]*ShowKnowledgeList, error)
GetKnowledgeList get knowledge list, include note and doc
func (*Engine) JSONUnmarshal ¶ added in v0.4.0
JSONUnmarshal json unmarshal
func (*Engine) MarshalAndSetCache ¶ added in v0.4.0
MarshalAndSetCache json marshal and set cache
type KnowledgeList ¶ added in v0.4.0
type KnowledgeList struct { Lock *sync.Mutex DocMap map[uint64]*ShowKnowledgeList NoteMap map[uint64]*ShowKnowledgeList }
KnowledgeList knowledge list
type ShowArchive ¶
type ShowArchive struct { ID uint64 Title string GUID string CommentCount uint64 ViewCount uint64 PostedTime string PostedDay string }
ShowArchive archive item
type ShowArticle ¶
type ShowArticle struct { ID uint64 Title string IfTop bool Abstract string GUID string CoverPicture string CommentCount uint64 ViewCount uint64 PostedTime string Tags []*ShowTag Categories []*ShowCategory }
ShowArticle output article model for list
func GetArticleList ¶
func GetArticleList(currentPage int, keyword string) (articleResult []*ShowArticle, pagination *utils.Pagination, err error)
GetArticleList get articles list
func GetArticleListByTaxonomy ¶
func GetArticleListByTaxonomy(currentPage int, taxonomyType, taxonomySlug, keyword string) (termName string, articleResult []*ShowArticle, pagination *utils.Pagination, err error)
GetArticleListByTaxonomy get articles list
type ShowArticleDetail ¶
type ShowArticleDetail struct { ID uint64 Title string ContentHTML template.HTML CommentStatus uint64 GUID string CommentCount uint64 ViewCount uint64 PostedTime string MetaData map[string]interface{} Tags []*ShowTag Categories []*ShowCategory }
ShowArticleDetail article detail output model
func GetArticleDetailByID ¶
func GetArticleDetailByID(articleID uint64) (*ShowArticleDetail, error)
GetArticleDetailByID get article detail by article id
type ShowCategory ¶
ShowCategory output category model
type ShowKnowledgeInfo ¶ added in v0.4.0
ShowKnowledgeInfo knowledge info output model
type ShowKnowledgeItemContent ¶ added in v0.4.0
ShowKnowledgeItemContent knowledge item content
type ShowKnowledgeItemTreeNode ¶ added in v0.4.0
type ShowKnowledgeItemTreeNode struct { ID uint64 Symbol uint64 Title string URL string Level uint64 Index int64 Children []*ShowKnowledgeItemTreeNode }
ShowWidgetCategoryTreeNode category tree node for widget
type ShowKnowledgeList ¶ added in v0.4.0
type ShowKnowledgeList struct { ID uint64 URL string Name string Slug string Description string CoverImageURL string UpdatedTime string }
ShowKnowledgeList show knowledge list output model
type ShowLastOrNextArticle ¶
ShowLastOrNextArticle last or next article url model
func GetLastArticle ¶
func GetLastArticle(currentArticleID uint64) *ShowLastOrNextArticle
GetLastArticle get last article title and url
func GetNextArticle ¶
func GetNextArticle(currentArticleID uint64) *ShowLastOrNextArticle
GetNextArticle get next article title and url
type ShowPageDetail ¶
type ShowPageDetail struct { ID uint64 Title string ContentHTML template.HTML CommentStatus uint64 GUID string CommentCount uint64 ViewCount uint64 PostedTime string MetaData map[string]interface{} }
ShowPageDetail page detail output model
func GetPageDetailByID ¶
func GetPageDetailByID(pageID uint64) (*ShowPageDetail, error)
GetPageDetailByID get page detail info by page id
type ShowSubjectInfo ¶
type ShowSubjectInfo struct { ID uint64 ParentURL string Name string Slug string Description string CoverImageURL string Count string }
ShowSubjectInfo show subjects info output model
func GetSubjectInfoBySlug ¶
func GetSubjectInfoBySlug(subjectSlug string) (*ShowSubjectInfo, error)
GetSubjectInfoBySlug get subject info by the unique slug
type ShowSubjectList ¶
type ShowSubjectList struct { ID uint64 URL string Name string Slug string Description string CoverImageURL string Count uint64 LastUpdated string SubLastUpdatedDay string }
ShowSubjectList show subjects list output model
func GetChildrenSubjects ¶ added in v0.4.0
func GetChildrenSubjects(parentID uint64) (subjectResult []*ShowSubjectList, err error)
GetChildrenSubjects get subject's all children If the parentID is 0, get all top subjects
type ShowWidgetCategoryTreeNode ¶
type ShowWidgetCategoryTreeNode struct { TermID uint64 Name string Slug string Count uint64 URL string Children []*ShowWidgetCategoryTreeNode }
ShowWidgetCategoryTreeNode category tree node for widget
func GetcategoryList ¶
func GetcategoryList() (taxonomyTree []*ShowWidgetCategoryTreeNode, err error)
GetcategoryList get category tree for widget
type ShowWidgetLatestArticles ¶
type ShowWidgetLatestArticles struct { ID string Title string GUID string CommentCount string ViewCount string PostedTime sql.NullTime }
ShowWidgetLatestArticles latest article list for widget Use {{ formatNullTime .PostedTime "2006-01-02 15:04" }} to decode the time
func GetLatestArticlesList ¶
func GetLatestArticlesList(getNums int) ([]*ShowWidgetLatestArticles, error)
GetLatestArticlesList get latest article list for widget
type SubjectInfoResult ¶ added in v0.4.0
type SubjectInfoResult struct { ID uint64 ParentID uint64 Name string Slug string Description string CoverImageURL string Count string }
SubjectInfoResult use for scan subject info
type SubjectList ¶
type SubjectList struct { Lock *sync.Mutex IDMap map[uint64]*ShowSubjectList }
SubjectList subject list