Versions in this module Expand all Collapse all v1 v1.0.2 Oct 19, 2018 Changes in this version + var ErrCommentClosed = errors.New("评论已关闭") + var ErrCommentContentNotEmpty = errors.New("评论内容不能为空") + var ErrDataNotExist = errors.New("数据不存在") + var ErrInvalidParameter = errors.New("Invalid parameter") + var ErrLDAPConnect = errors.New("无法连接到LDAP服务器") + var ErrLDAPFirstBind = errors.New("第一次LDAP绑定失败") + var ErrLDAPSearch = errors.New("LDAP搜索失败") + var ErrLDAPUserNotFoundOrTooMany = errors.New("LDAP用户不存在或者多于一个") + var ErrMemberAccountFormatError = errors.New("账号只能由英文字母数字组成,且在3-50个字符") + var ErrMemberAuthMethodInvalid = errors.New("不支持此认证方式") + var ErrMemberDescriptionTooLong = errors.New("用户描述必须小于500字") + var ErrMemberDisabled = errors.New("用户被禁用") + var ErrMemberEmailEmpty = errors.New("用户邮箱不能为空") + var ErrMemberEmailExist = errors.New("用户邮箱已被使用") + var ErrMemberEmailFormatError = errors.New("邮箱格式不正确") + var ErrMemberExist = errors.New("用户已存在") + var ErrMemberNoExist = errors.New("用户不存在") + var ErrMemberPasswordFormatError = errors.New("密码必须在6-50个字符之间") + var ErrMemberRoleError = errors.New("用户权限不正确") + var ErrPermissionDenied = errors.New("Permission denied") + var ErrorMemberPasswordError = errors.New("用户密码错误") + func BackgroupConvert(sessionId string, bookResult *BookResult) error + func GetOptionValue(key, def string) string + type Attachment struct + AttachmentId int + BookId int + CreateAt int + CreateTime time.Time + DocumentId int + FileExt string + FileName string + FilePath string + FileSize float64 + HttpPath string + func NewAttachment() *Attachment + func (m *Attachment) Delete() error + func (m *Attachment) Find(id int) (*Attachment, error) + func (m *Attachment) FindListByDocumentId(docId int) (attaches []*Attachment, err error) + func (m *Attachment) FindToPager(pageIndex, pageSize int) (attachList []*AttachmentResult, totalCount int, err error) + func (m *Attachment) Insert() error + func (m *Attachment) TableEngine() string + func (m *Attachment) TableName() string + func (m *Attachment) TableNameWithPrefix() string + func (m *Attachment) Update() error + type AttachmentResult struct + Account string + BookName string + DocumentName string + FileShortSize string + IsExist bool + LocalHttpPath string + func NewAttachmentResult() *AttachmentResult + func (m *AttachmentResult) Find(id int) (*AttachmentResult, error) + type Blog struct + AttachList []*Attachment + BlogContent string + BlogExcerpt string + BlogId int + BlogIdentify string + BlogRelease string + BlogStatus string + BlogTitle string + BlogType int + BookId int + BookIdentify string + CreateName string + Created time.Time + DocumentId int + DocumentIdentify string + MemberAvatar string + MemberId int + Modified time.Time + ModifyAt int + ModifyRealName string + OrderIndex int + Password string + Version int64 + func NewBlog() *Blog + func (b *Blog) Delete(blogId int) error + func (b *Blog) Find(blogId int) (*Blog, error) + func (b *Blog) FindByIdAndMemberId(blogId, memberId int) (*Blog, error) + func (b *Blog) FindByIdentify(identify string) (*Blog, error) + func (b *Blog) FindFromCache(blogId int) (blog *Blog, err error) + func (b *Blog) FindToPager(pageIndex, pageSize int, memberId int, status string) (blogList []*Blog, totalCount int, err error) + func (b *Blog) IsExist(identify string) bool + func (b *Blog) Link() (*Blog, error) + func (b *Blog) LinkAttach() (err error) + func (b *Blog) Processor() *Blog + func (b *Blog) QueryNext(blogId int) (*Blog, error) + func (b *Blog) QueryPrevious(blogId int) (*Blog, error) + func (b *Blog) Save(cols ...string) error + func (m *Blog) TableEngine() string + func (m *Blog) TableName() string + func (m *Blog) TableNameWithPrefix() string + func (m *Blog) TableUnique() [][]string + type BlogResult struct + type Book struct + AutoRelease int + AutoSave int + BookId int + BookName string + CommentCount int + CommentStatus string + Cover string + CreateTime time.Time + Description string + DocCount int + Editor string + HistoryCount int + Identify string + IsDownload int + IsEnableShare int + IsUseFirstDocument int + Label string + MemberId int + ModifyTime time.Time + OrderIndex int + PrivateToken string + PrivatelyOwned int + Publisher string + Status int + Theme string + Version int64 + func NewBook() *Book + func (book *Book) Copy(identify string) error + func (book *Book) Find(id int, cols ...string) (*Book, error) + func (book *Book) FindByField(field string, value interface{}, cols ...string) ([]*Book, error) + func (book *Book) FindByFieldFirst(field string, value interface{}) (*Book, error) + func (book *Book) FindByIdentify(identify string, cols ...string) (*Book, error) + func (book *Book) FindForHomeToPager(pageIndex, pageSize, member_id int) (books []*BookResult, totalCount int, err error) + func (book *Book) FindForLabelToPager(keyword string, pageIndex, pageSize, memberId int) (books []*BookResult, totalCount int, err error) + func (book *Book) FindToPager(pageIndex, pageSize, memberId int) (books []*BookResult, totalCount int, err error) + func (book *Book) ImportBook(zipPath string) error + func (book *Book) Insert() error + func (book *Book) ReleaseContent(bookId int) + func (book *Book) ResetDocumentNumber(bookId int) + func (book *Book) String() string + func (book *Book) TableEngine() string + func (book *Book) TableName() string + func (book *Book) TableNameWithPrefix() string + func (book *Book) ThoroughDeleteBook(id int) error + func (book *Book) Update(cols ...string) error + type BookResult struct + AutoRelease bool + AutoSave bool + BookId int + BookName string + CommentCount int + CommentStatus string + Cover string + CreateName string + CreateTime time.Time + Description string + DocCount int + Editor string + HistoryCount int + Identify string + IsDisplayComment bool + IsDownload bool + IsEnableShare bool + IsUseFirstDocument bool + Label string + LastModifyText string + MemberId int + ModifyTime time.Time + OrderIndex int + PrivateToken string + PrivatelyOwned int + Publisher string + RealName string + RelationshipId int + RoleId int + RoleName string + Status int + Theme string + func NewBookResult() *BookResult + func (b *BookResult) String() string + func (m *BookResult) Converter(sessionId string) (ConvertBookResult, error) + func (m *BookResult) ExportMarkdown(sessionId string) (string, error) + func (m *BookResult) FindByIdentify(identify string, memberId int, cols ...string) (*BookResult, error) + func (m *BookResult) FindFirstDocumentByBookId(bookId int) (*Document, error) + func (m *BookResult) FindToPager(pageIndex, pageSize int) (books []*BookResult, totalCount int, err error) + func (m *BookResult) ToBookResult(book Book) *BookResult + type Comment struct + AgainstCount int + AgreeCount int + Approved int + Author string + BookId int + CommentDate time.Time + CommentId int + Content string + DocumentId int + Floor int + IPAddress string + MemberId int + ParentId int + UserAgent string + func NewComment() *Comment + func (m *Comment) Find(id int) (*Comment, error) + func (m *Comment) Insert() error + func (m *Comment) TableEngine() string + func (m *Comment) TableName() string + func (m *Comment) TableNameWithPrefix() string + func (m *Comment) Update(cols ...string) error + type CommentResult struct + Author string + ReplyAccount string + func (m *CommentResult) FindForDocumentToPager(doc_id, page_index, page_size int) (comments []*CommentResult, totalCount int, err error) + type CommentVote struct + CommentId int + CommentMemberId int + CreateTime time.Time + VoteId int + VoteMemberId int + VoteState int + func NewCommentVote() *CommentVote + func (m *CommentVote) InsertOrUpdate() (*CommentVote, error) + func (m *CommentVote) TableEngine() string + func (m *CommentVote) TableName() string + func (m *CommentVote) TableNameWithPrefix() string + func (u *CommentVote) TableUnique() [][]string + type ConvertBookResult struct + EpubPath string + MobiPath string + PDFPath string + WordPath string + type Dashboard struct + AttachmentNumber int64 + BookNumber int64 + CommentNumber int64 + DocumentNumber int64 + MemberNumber int64 + func NewDashboard() *Dashboard + func (m *Dashboard) Query() *Dashboard + type Document struct + AttachList []*Attachment + BookId int + Content string + CreateTime time.Time + DocumentId int + DocumentName string + Identify string + IsOpen int + Markdown string + MemberId int + ModifyAt int + ModifyTime time.Time + OrderSort int + ParentId int + Release string + Version int64 + func NewDocument() *Document + func (item *Document) CreateDocumentTreeForHtml(bookId, selectedId int) (string, error) + func (item *Document) Find(id int) (*Document, error) + func (item *Document) FindByIdentityFirst(identify string, bookId int) (*Document, error) + func (item *Document) FindDocumentTree(bookId int) ([]*DocumentTree, error) + func (item *Document) FindListByBookId(bookId int) (docs []*Document, err error) + func (item *Document) FromCacheById(id int) (*Document, error) + func (item *Document) FromCacheByIdentify(identify string, bookId int) (*Document, error) + func (item *Document) InsertOrUpdate(cols ...string) error + func (item *Document) IsExist(documentId int) bool + func (item *Document) Processor() *Document + func (item *Document) PutToCache() + func (item *Document) RecursiveDocument(docId int) error + func (item *Document) ReleaseContent() error + func (item *Document) RemoveCache() + func (item *Document) TableEngine() string + func (item *Document) TableName() string + func (item *Document) TableNameWithPrefix() string + func (item *Document) TableUnique() [][]string + type DocumentHistory struct + Action string + ActionName string + Content string + DocumentId int + DocumentName string + HistoryId int + IsOpen int + Markdown string + MemberId int + ModifyAt int + ModifyTime time.Time + ParentId int + Version int64 + func NewDocumentHistory() *DocumentHistory + func (m *DocumentHistory) Clear(docId int) error + func (m *DocumentHistory) Delete(historyId, docId int) error + func (m *DocumentHistory) Find(id int) (*DocumentHistory, error) + func (m *DocumentHistory) FindToPager(docId, pageIndex, pageSize int) (docs []*DocumentHistorySimpleResult, totalCount int, err error) + func (m *DocumentHistory) InsertOrUpdate() (history *DocumentHistory, err error) + func (m *DocumentHistory) Restore(historyId, docId, uid int) error + func (m *DocumentHistory) TableEngine() string + func (m *DocumentHistory) TableName() string + func (m *DocumentHistory) TableNameWithPrefix() string + type DocumentHistorySimpleResult struct + Account string + ActionName string + HistoryId int + MemberId int + ModifyAt int + ModifyName string + ModifyTime time.Time + Version int64 + type DocumentSearchResult struct + Author string + BookId int + BookIdentify string + BookName string + CreateTime time.Time + Description string + DocumentId int + DocumentName string + Identify string + ModifyTime time.Time + func NewDocumentSearchResult() *DocumentSearchResult + func (m *DocumentSearchResult) FindToPager(keyword string, page_index, page_size, member_id int) (search_result []*DocumentSearchResult, total_count int, err error) + func (m *DocumentSearchResult) SearchDocument(keyword string, book_id int) (docs []*DocumentSearchResult, err error) + type DocumentSelected struct + Opened bool + Selected bool + type DocumentTree struct + AAttrs map[string]interface{} + BookIdentify string + DocumentId int + DocumentName string + Identify string + ParentId interface{} + State *DocumentSelected + Version int64 + type KeyValueItem struct + Id int + Text string + type Label struct + BookNumber int + LabelId int + LabelName string + func NewLabel() *Label + func (m *Label) Delete() error + func (m *Label) FindFirst(field string, value interface{}) (*Label, error) + func (m *Label) FindToPager(pageIndex, pageSize int) (labels []*Label, totalCount int, err error) + func (m *Label) InsertOrUpdate(labelName string) error + func (m *Label) InsertOrUpdateMulti(labels string) + func (m *Label) TableEngine() string + func (m *Label) TableName() string + func (m *Label) TableNameWithPrefix() string + type Logger struct + Category string + Content string + CreateTime time.Time + IPAddress string + LoggerId int64 + MemberId int + OriginalData string + PresentData string + UserAgent string + func NewLogger() *Logger + func (m *Logger) Add() error + func (m *Logger) TableEngine() string + func (m *Logger) TableName() string + func (m *Logger) TableNameWithPrefix() string + type Member struct + Account string + AuthMethod string + Avatar string + CreateAt int + CreateTime time.Time + Description string + Email string + LastLoginTime time.Time + MemberId int + Password string + Phone string + RealName string + Role int + RoleName string + Status int + func NewMember() *Member + func (c *Member) IsAdministrator() bool + func (m *Member) Add() error + func (m *Member) Delete(oldId int, newId int) error + func (m *Member) Find(id int, cols ...string) (*Member, error) + func (m *Member) FindByAccount(account string) (*Member, error) + func (m *Member) FindByAccountList(accounts ...string) ([]*Member, error) + func (m *Member) FindByFieldFirst(field string, value interface{}) (*Member, error) + func (m *Member) FindToPager(pageIndex, pageSize int) ([]*Member, int, error) + func (m *Member) Login(account string, password string) (*Member, error) + func (m *Member) ResolveRoleName() + func (m *Member) TableEngine() string + func (m *Member) TableName() string + func (m *Member) TableNameWithPrefix() string + func (m *Member) Update(cols ...string) error + func (m *Member) Valid(is_hash_password bool) error + type MemberRelationshipResult struct + Account string + Avatar string + BookId int + CreateAt int + CreateTime time.Time + Description string + Email string + MemberId int + Phone string + RealName string + RelationshipId int + Role int + RoleId int + RoleName string + Status int + func NewMemberRelationshipResult() *MemberRelationshipResult + func (m *MemberRelationshipResult) FindForUsersByBookId(bookId, pageIndex, pageSize int) ([]*MemberRelationshipResult, int, error) + func (m *MemberRelationshipResult) FindNotJoinUsersByAccount(bookId, limit int, account string) ([]*Member, error) + func (m *MemberRelationshipResult) FromMember(member *Member) *MemberRelationshipResult + func (m *MemberRelationshipResult) ResolveRoleName() *MemberRelationshipResult + type MemberToken struct + Email string + IsValid bool + MemberId int + SendTime time.Time + Token string + TokenId int + ValidTime time.Time + func NewMemberToken() *MemberToken + func (m *MemberToken) FindByFieldFirst(field string, value interface{}) (*MemberToken, error) + func (m *MemberToken) FindSendCount(mail string, start_time time.Time, end_time time.Time) (int, error) + func (m *MemberToken) InsertOrUpdate() (*MemberToken, error) + func (m *MemberToken) TableEngine() string + func (m *MemberToken) TableName() string + func (m *MemberToken) TableNameWithPrefix() string + type Migration struct + CreateTime time.Time + MigrationId int + Name string + Statements string + Status string + Version int64 + func NewMigration() *Migration + func (m *Migration) FindFirst() (*Migration, error) + func (m *Migration) TableEngine() string + func (m *Migration) TableName() string + func (m *Migration) TableNameWithPrefix() string + type Model struct + type Option struct + OptionId int + OptionName string + OptionTitle string + OptionValue string + Remark string + func NewOption() *Option + func (m *Option) Init() error + func (m *Option) TableEngine() string + func (m *Option) TableName() string + func (m *Option) TableNameWithPrefix() string + func (p *Option) All() ([]*Option, error) + func (p *Option) Find(id int) (*Option, error) + func (p *Option) FindByKey(key string) (*Option, error) + func (p *Option) InsertMulti(option ...Option) error + func (p *Option) InsertOrUpdate() error + type Relationship struct + BookId int + MemberId int + RelationshipId int + RoleId int + func NewRelationship() *Relationship + func (m *Relationship) DeleteByBookIdAndMemberId(book_id, member_id int) error + func (m *Relationship) Find(id int) (*Relationship, error) + func (m *Relationship) FindByBookIdAndMemberId(book_id, member_id int) (*Relationship, error) + func (m *Relationship) FindForRoleId(book_id, member_id int) (int, error) + func (m *Relationship) FindFounder(book_id int) (*Relationship, error) + func (m *Relationship) Insert() error + func (m *Relationship) TableEngine() string + func (m *Relationship) TableName() string + func (m *Relationship) TableNameWithPrefix() string + func (m *Relationship) Transfer(book_id, founder_id, receive_id int) error + func (m *Relationship) Update() error + func (m *Relationship) UpdateRoleId(book_id, member_id, role_id int) (*Relationship, error) + func (u *Relationship) TableUnique() [][]string + type SelectMemberResult struct + Result []KeyValueItem + type Template struct + BookId int + BookName string + CreateName string + CreateTime time.Time + IsGlobal int + MemberId int + ModifyAt int + ModifyName string + ModifyTime time.Time + TemplateContent string + TemplateId int + TemplateName string + Version int64 + func NewTemplate() *Template + func (m *Template) TableEngine() string + func (m *Template) TableName() string + func (m *Template) TableNameWithPrefix() string + func (t *Template) Delete(templateId int, memberId int) error + func (t *Template) Find(templateId int) (*Template, error) + func (t *Template) FindAllByBookId(bookId int) ([]*Template, error) + func (t *Template) FindByBookId(bookId int) ([]*Template, error) + func (t *Template) Preload() *Template + func (t *Template) Save(cols ...string) (err error)