Documentation ¶
Index ¶
- Constants
- Variables
- func InitAdsCont(logger *logger.Client, db *gorm.DB) *adsCont
- func InitAttachment(logger *logger.Client, db *gorm.DB) *attachment
- func InitAwesome(logger *logger.Client, db *gorm.DB) *awesome
- func InitAwesomeCate(logger *logger.Client, db *gorm.DB) *awesomeCate
- func InitBanner(logger *logger.Client, db *gorm.DB) *banner
- func InitBook(logger *logger.Client, db *gorm.DB) *book
- func InitBookCategory(logger *logger.Client, db *gorm.DB) *bookCategory
- func InitBookCounter(logger *logger.Client, db *gorm.DB) *bookCounter
- func InitBookmark(logger *logger.Client, db *gorm.DB) *bookmark
- func InitCategory(logger *logger.Client, db *gorm.DB) *category
- func InitComments(logger *logger.Client, db *gorm.DB) *comments
- func InitDocument(logger *logger.Client, db *gorm.DB) *document
- func InitDocumentHistory(logger *logger.Client, db *gorm.DB) *documentHistory
- func InitDocumentStore(logger *logger.Client, db *gorm.DB) *documentStore
- func InitFans(logger *logger.Client, db *gorm.DB) *fans
- func InitFriendLink(logger *logger.Client, db *gorm.DB) *friendLink
- func InitGithubUser(logger *logger.Client, db *gorm.DB) *githubUser
- func InitLabel(logger *logger.Client, db *gorm.DB) *label
- func InitLogs(logger *logger.Client, db *gorm.DB) *logs
- func InitMember(logger *logger.Client, db *gorm.DB) *member
- func InitMemberToken(logger *logger.Client, db *gorm.DB) *memberToken
- func InitOption(logger *logger.Client, db *gorm.DB) *option
- func InitReadCount(logger *logger.Client, db *gorm.DB) *readCount
- func InitReadRecord(logger *logger.Client, db *gorm.DB) *readRecord
- func InitReadingTime(logger *logger.Client, db *gorm.DB) *readingTime
- func InitRelationship(logger *logger.Client, db *gorm.DB) *relationship
- func InitScore(logger *logger.Client, db *gorm.DB) *score
- func InitSeo(logger *logger.Client, db *gorm.DB) *seo
- func InitSign(logger *logger.Client, db *gorm.DB) *sign
- func InitStar(logger *logger.Client, db *gorm.DB) *star
- func InitTool(logger *logger.Client, db *gorm.DB) *tool
- func InitUser(logger *logger.Client, db *gorm.DB) *user
- func InitWechat(logger *logger.Client, db *gorm.DB) *wechat
- func InterfaceToJson(itf interface{}) string
- func NewDocumentSearchResult() *documentSearchResult
- func NewElasticSearchClient() (client *elasticSearchClient)
- func NewGithubApi() *githubApi
- func NewGlobal() *global
- func NewVersionControl(docId int, version int64) *versionControl
- func SetIncreAndDecre(table string, field string, condition string, incre bool, step ...int) (err error)
- type DocumentSelected
- type DocumentTree
- type ElasticSearchCount
- type ElasticSearchData
- type ElasticSearchResult
- type GithubInfoResp
- type ReadingRule
- type Token
- type Tokens
- type TotalResult
Constants ¶
View Source
const ( UserInit = 0 UserActived = 1 UserBanned = 2 )
Variables ¶
View Source
var ( Global *global DocumentSearchResult *documentSearchResult GithubApi *githubApi )
View Source
var ( ReadingTime *readingTime DocumentStore *documentStore Comments *comments BookCounter *bookCounter Seo *seo Wechat *wechat BookCategory *bookCategory Fans *fans Attachment *attachment ReadRecord *readRecord FriendLink *friendLink MemberToken *memberToken Document *document Score *score DocumentHistory *documentHistory Sign *sign Bookmark *bookmark Label *label GithubUser *githubUser Member *member Relationship *relationship Awesome *awesome ReadCount *readCount Banner *banner Logs *logs Category *category User *user AwesomeCate *awesomeCate Option *option Tool *tool Star *star AdsCont *adsCont Book *book )
View Source
var ( // ErrMemberNoExist 用户不存在. ErrMemberNoExist = errors.New("用户不存在") ErrMemberExist = errors.New("用户已存在") ErrMemberDisabled = errors.New("用户被禁用") ErrMemberEmailEmpty = errors.New("用户邮箱不能为空") ErrMemberEmailExist = errors.New("用户邮箱已被使用") ErrMemberDescriptionTooLong = errors.New("用户描述必须小于500字") ErrMemberEmailFormatError = errors.New("邮箱格式不正确") ErrMemberPasswordFormatError = errors.New("密码必须在6-50个字符之间") ErrMemberAccountFormatError = errors.New("账号只能由英文字母数字组成,且在3-50个字符") ErrMemberRoleError = errors.New("用户权限不正确") // ErrorMemberPasswordError 密码错误. ErrorMemberPasswordError = errors.New("用户密码错误") //ErrorMemberAuthMethodInvalid 不支持此认证方式 ErrMemberAuthMethodInvalid = errors.New("不支持此认证方式") //ErrLDAPConnect 无法连接到LDAP服务器 ErrLDAPConnect = errors.New("无法连接到LDAP服务器") //ErrLDAPFirstBind 第一次LDAP绑定失败 ErrLDAPFirstBind = errors.New("第一次LDAP绑定失败") //ErrLDAPSearch LDAP搜索失败 ErrLDAPSearch = errors.New("LDAP搜索失败") //ErrLDAPUserNotFoundOrTooMany ErrLDAPUserNotFoundOrTooMany = errors.New("LDAP用户不存在或者多于一个") // ErrDataNotExist 指定的服务已存在. ErrDataNotExist = errors.New("数据不存在") // ErrInvalidParameter 参数错误. ErrInvalidParameter = errors.New("Invalid parameter") ErrPermissionDenied = errors.New("Permission denied") ErrCommentClosed = errors.New("评论已关闭") ErrCommentContentNotEmpty = errors.New("评论内容不能为空") )
View Source
var IsRebuildAllIndex = false
是否正在创建全量索引
Functions ¶
func InitDocumentHistory ¶
func InterfaceToJson ¶
func InterfaceToJson(itf interface{}) string
将interface数据转json @param itf 将数据转成json @return 返回json字符串
func NewDocumentSearchResult ¶
func NewDocumentSearchResult() *documentSearchResult
func NewGithubApi ¶
func NewGithubApi() *githubApi
func NewVersionControl ¶
Types ¶
type DocumentSelected ¶
type DocumentTree ¶
type ElasticSearchCount ¶
type ElasticSearchCount struct { Shards struct { Failed int `json:"failed"` Skipped int `json:"skipped"` Successful int `json:"successful"` Total int `json:"total"` } `json:"_shards"` Count int `json:"count"` }
统计信息结构
type ElasticSearchData ¶
type ElasticSearchData struct { Id int `json:"id"` //文档或书籍id BookId int `json:"book_id"` //书籍id。这里的book_id起到的作用是IsBooK的布尔,以及搜索书籍文档时候的过滤 Title string `json:"title"` //文档标题或书籍名称 Keywords string `json:"keywords"` //文档或书籍关键字 Content string `json:"content"` //文档摘要或书籍文本内容 Vcnt int `json:"vcnt"` //浏览量 Private int `json:"private"` //书籍或者文档是否是公开的 }
全文搜索
type ElasticSearchResult ¶
type ElasticSearchResult struct { Shards struct { Failed int `json:"failed"` Skipped int `json:"skipped"` Successful int `json:"successful"` Total int `json:"total"` } `json:"_shards"` Hits struct { Hits []struct { ID string `json:"_id"` Index string `json:"_index"` Score interface{} `json:"_score"` Source struct { Id int `json:"id"` BookId int `json:"book_id"` Title string `json:"title"` Keywords string `json:"keywords"` Content string `json:"content"` Vcnt int `json:"vcnt"` Private int `json:"private"` } `json:"_source"` Type string `json:"_type"` Sort []int `json:"sort"` } `json:"hits"` MaxScore interface{} `json:"max_score"` Total int `json:"total"` } `json:"hits"` TimedOut bool `json:"timed_out"` Took int `json:"took"` }
搜索结果结构
type GithubInfoResp ¶
type GithubInfoResp struct { TotalCount int `json:"total_count"` IncompleteResults bool `json:"incomplete_results"` Items []struct { ID int `json:"id"` NodeID string `json:"node_id"` Name string `json:"name"` FullName string `json:"full_name"` Private bool `json:"private"` Owner struct { Login string `json:"login"` ID int `json:"id"` NodeID string `json:"node_id"` AvatarURL string `json:"avatar_url"` GravatarID string `json:"gravatar_id"` URL string `json:"url"` HTMLURL string `json:"html_url"` FollowersURL string `json:"followers_url"` FollowingURL string `json:"following_url"` GistsURL string `json:"gists_url"` StarredURL string `json:"starred_url"` SubscriptionsURL string `json:"subscriptions_url"` OrganizationsURL string `json:"organizations_url"` ReposURL string `json:"repos_url"` EventsURL string `json:"events_url"` ReceivedEventsURL string `json:"received_events_url"` Type string `json:"type"` SiteAdmin bool `json:"site_admin"` } `json:"owner"` HTMLURL string `json:"html_url"` Description string `json:"description"` Fork bool `json:"fork"` URL string `json:"url"` ForksURL string `json:"forks_url"` KeysURL string `json:"keys_url"` CollaboratorsURL string `json:"collaborators_url"` TeamsURL string `json:"teams_url"` HooksURL string `json:"hooks_url"` IssueEventsURL string `json:"issue_events_url"` EventsURL string `json:"events_url"` AssigneesURL string `json:"assignees_url"` BranchesURL string `json:"branches_url"` TagsURL string `json:"tags_url"` BlobsURL string `json:"blobs_url"` GitTagsURL string `json:"git_tags_url"` GitRefsURL string `json:"git_refs_url"` TreesURL string `json:"trees_url"` StatusesURL string `json:"statuses_url"` LanguagesURL string `json:"languages_url"` StargazersURL string `json:"stargazers_url"` ContributorsURL string `json:"contributors_url"` SubscribersURL string `json:"subscribers_url"` SubscriptionURL string `json:"subscription_url"` CommitsURL string `json:"commits_url"` GitCommitsURL string `json:"git_commits_url"` CommentsURL string `json:"comments_url"` IssueCommentURL string `json:"issue_comment_url"` ContentsURL string `json:"contents_url"` CompareURL string `json:"compare_url"` MergesURL string `json:"merges_url"` ArchiveURL string `json:"archive_url"` DownloadsURL string `json:"downloads_url"` IssuesURL string `json:"issues_url"` PullsURL string `json:"pulls_url"` MilestonesURL string `json:"milestones_url"` NotificationsURL string `json:"notifications_url"` LabelsURL string `json:"labels_url"` ReleasesURL string `json:"releases_url"` DeploymentsURL string `json:"deployments_url"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` PushedAt time.Time `json:"pushed_at"` GitURL string `json:"git_url"` SSHURL string `json:"ssh_url"` CloneURL string `json:"clone_url"` SvnURL string `json:"svn_url"` Homepage string `json:"homepage"` Size int `json:"size"` StargazersCount int `json:"stargazers_count"` WatchersCount int `json:"watchers_count"` Language string `json:"language"` HasIssues bool `json:"has_issues"` HasProjects bool `json:"has_projects"` HasDownloads bool `json:"has_downloads"` HasWiki bool `json:"has_wiki"` HasPages bool `json:"has_pages"` ForksCount int `json:"forks_count"` MirrorURL interface{} `json:"mirror_url"` Archived bool `json:"archived"` Disabled bool `json:"disabled"` OpenIssuesCount int `json:"open_issues_count"` License struct { Key string `json:"key"` Name string `json:"name"` SpdxID string `json:"spdx_id"` URL string `json:"url"` NodeID string `json:"node_id"` } `json:"license"` Forks int `json:"forks"` OpenIssues int `json:"open_issues"` Watchers int `json:"watchers"` DefaultBranch string `json:"default_branch"` Score float64 `json:"score"` } `json:"items"` }
type Token ¶
type Token struct { EndOffset int `json:"end_offset"` Position int `json:"position"` StartOffset int `json:"start_offset"` Token string `json:"token"` Type string `json:"type"` }
分词
type TotalResult ¶
type TotalResult struct {
Cnt int
}
Source Files ¶
- acommon.go
- ads_cont.gen.go
- attachment.gen.addition.go
- attachment.gen.go
- awesome.gen.go
- awesome_cate.gen.go
- banner.gen.addition.go
- banner.gen.go
- book.gen.addition.go
- book.gen.go
- book_category.gen.addition.go
- book_category.gen.go
- book_counter.gen.go
- bookmark.gen.addition.go
- bookmark.gen.go
- category.gen.addition.go
- category.gen.go
- comments.gen.addition.go
- comments.gen.go
- declare.gen.addition.go
- declare.gen.go
- document.gen.addition.go
- document.gen.go
- document_history.gen.addition.go
- document_history.gen.go
- document_search_result.go
- document_store.gen.addition.go
- document_store.gen.go
- document_tree.go
- elastic_search.go
- errors.go
- fans.gen.go
- friend_link.gen.go
- github.go
- github_user.gen.go
- global.go
- label.gen.addition.go
- label.gen.go
- logs.gen.go
- member.gen.addition.go
- member.gen.go
- member_token.gen.addition.go
- member_token.gen.go
- option.gen.go
- read_count.gen.go
- read_record.gen.addition.go
- read_record.gen.go
- reading_time.gen.go
- relationship.gen.addition.go
- relationship.gen.go
- score.gen.addition.go
- score.gen.go
- seo.gen.go
- sign.gen.go
- star.gen.addition.go
- star.gen.go
- tool.gen.go
- user.gen.addition.go
- user.gen.go
- version_control.go
- wechat.gen.go
Click to show internal directories.
Click to hide internal directories.