models

package
v1.12.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 11, 2021 License: Apache-2.0, Apache-2.0 Imports: 35 Imported by: 0

Documentation

Overview

数据库模型.

Package models 为项目所需的模型对象定义.

Package models .

Index

Constants

This section is empty.

Variables

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("评论内容不能为空")
)

Functions

func BackgroundConvert

func BackgroundConvert(sessionId string, bookResult *BookResult) error

后台转换

func GetOptionValue

func GetOptionValue(key, def string) string

Types

type Attachment

type Attachment struct {
	AttachmentId int       `orm:"column(attachment_id);pk;auto;unique" json:"attachment_id"`
	BookId       int       `orm:"column(book_id);type(int)" json:"book_id"`
	DocumentId   int       `orm:"column(document_id);type(int);null" json:"doc_id"`
	FileName     string    `orm:"column(file_name);size(255)" json:"file_name"`
	FilePath     string    `orm:"column(file_path);size(2000)" json:"file_path"`
	FileSize     float64   `orm:"column(file_size);type(float)" json:"file_size"`
	HttpPath     string    `orm:"column(http_path);size(2000)" json:"http_path"`
	FileExt      string    `orm:"column(file_ext);size(50)" json:"file_ext"`
	CreateTime   time.Time `orm:"type(datetime);column(create_time);auto_now_add" json:"create_time"`
	CreateAt     int       `orm:"column(create_at);type(int)" json:"create_at"`
}

Attachment struct .

func NewAttachment

func NewAttachment() *Attachment

func (*Attachment) Delete

func (m *Attachment) Delete() error

func (*Attachment) Find

func (m *Attachment) Find(id int) (*Attachment, error)

func (*Attachment) FindListByDocumentId

func (m *Attachment) FindListByDocumentId(docId int) (attaches []*Attachment, err error)

查询指定文档的附件列表

func (*Attachment) FindToPager

func (m *Attachment) FindToPager(pageIndex, pageSize int) (attachList []*AttachmentResult, totalCount int, err error)

分页查询附件

func (*Attachment) Insert

func (m *Attachment) Insert() error

func (*Attachment) TableEngine

func (m *Attachment) TableEngine() string

TableEngine 获取数据使用的引擎.

func (*Attachment) TableName

func (m *Attachment) TableName() string

TableName 获取对应数据库表名.

func (*Attachment) TableNameWithPrefix

func (m *Attachment) TableNameWithPrefix() string

func (*Attachment) Update

func (m *Attachment) Update() error

type AttachmentResult

type AttachmentResult struct {
	Attachment
	IsExist       bool
	BookName      string
	DocumentName  string
	FileShortSize string
	Account       string
	LocalHttpPath string
}

func NewAttachmentResult

func NewAttachmentResult() *AttachmentResult

func (*AttachmentResult) Find

func (m *AttachmentResult) Find(id int) (*AttachmentResult, error)

type Blog

type Blog struct {
	BlogId int `orm:"pk;auto;unique;column(blog_id)" json:"blog_id"`
	//文章标题
	BlogTitle string `orm:"column(blog_title);size(500)" json:"blog_title"`
	//文章标识
	BlogIdentify string `orm:"column(blog_identify);size(100);unique" json:"blog_identify"`
	//排序序号
	OrderIndex int `orm:"column(order_index);type(int);default(0)" json:"order_index"`
	//所属用户
	MemberId int `orm:"column(member_id);type(int);default(0);index" json:"member_id"`
	//用户头像
	MemberAvatar string `orm:"-" json:"member_avatar"`
	//文章类型:0 普通文章/1 链接文章
	BlogType int `orm:"column(blog_type);type(int);default(0)" json:"blog_type"`
	//链接到的项目中的文档ID
	DocumentId int `orm:"column(document_id);type(int);default(0)" json:"document_id"`
	//文章的标识
	DocumentIdentify string `orm:"-" json:"document_identify"`
	//关联文档的项目标识
	BookIdentify string `orm:"-" json:"book_identify"`
	//关联文档的项目ID
	BookId int `orm:"-" json:"book_id"`
	//文章摘要
	BlogExcerpt string `orm:"column(blog_excerpt);size(1500)" json:"blog_excerpt"`
	//文章内容
	BlogContent string `orm:"column(blog_content);type(text);null" json:"blog_content"`
	//发布后的文章内容
	BlogRelease string `orm:"column(blog_release);type(text);null" json:"blog_release"`
	//文章当前的状态,枚举enum(’publish’,’draft’,’password’)值,publish为已 发表,draft为草稿,password 为私人内容(不会被公开) 。默认为publish。
	BlogStatus string `orm:"column(blog_status);size(100);default(publish)" json:"blog_status"`
	//文章密码,varchar(100)值。文章编辑才可为文章设定一个密码,凭这个密码才能对文章进行重新强加或修改。
	Password string `orm:"column(password);size(100)" json:"-"`
	//最后修改时间
	Modified time.Time `orm:"column(modify_time);type(datetime);auto_now" json:"modify_time"`
	//修改人id
	ModifyAt       int    `orm:"column(modify_at);type(int)" json:"-"`
	ModifyRealName string `orm:"-" json:"modify_real_name"`
	//创建时间
	Created    time.Time `orm:"column(create_time);type(datetime);auto_now_add" json:"create_time"`
	CreateName string    `orm:"-" json:"create_name"`
	//版本号
	Version int64 `orm:"type(bigint);column(version)" json:"version"`
	//附件列表
	AttachList []*Attachment `orm:"-" json:"attach_list"`
}

博文表

func NewBlog

func NewBlog() *Blog

func (*Blog) Delete

func (b *Blog) Delete(blogId int) error

删除文章

func (*Blog) Find

func (b *Blog) Find(blogId int) (*Blog, error)

根据文章ID查询文章

func (*Blog) FindByIdAndMemberId

func (b *Blog) FindByIdAndMemberId(blogId, memberId int) (*Blog, error)

查找指定用户的指定文章

func (*Blog) FindByIdentify

func (b *Blog) FindByIdentify(identify string) (*Blog, error)

根据文章标识查询文章

func (*Blog) FindFromCache

func (b *Blog) FindFromCache(blogId int) (blog *Blog, err error)

从缓存中读取文章

func (*Blog) FindToPager

func (b *Blog) FindToPager(pageIndex, pageSize int, memberId int, status string) (blogList []*Blog, totalCount int, err error)

分页查询文章列表

func (*Blog) IsExist

func (b *Blog) IsExist(identify string) bool

判断指定的文章标识是否存在

func (b *Blog) Link() (*Blog, error)

获取指定文章的链接内容

func (*Blog) LinkAttach

func (b *Blog) LinkAttach() (err error)

关联文章附件

func (*Blog) Processor

func (b *Blog) Processor() *Blog

过滤文章的危险标签,处理文章外链以及图片.

func (*Blog) QueryNext

func (b *Blog) QueryNext(blogId int) (*Blog, error)

查询下一篇文章

func (*Blog) QueryPrevious

func (b *Blog) QueryPrevious(blogId int) (*Blog, error)

查询下一篇文章

func (*Blog) Save

func (b *Blog) Save(cols ...string) error

保存文章

func (*Blog) TableEngine

func (b *Blog) TableEngine() string

TableEngine 获取数据使用的引擎.

func (*Blog) TableName

func (b *Blog) TableName() string

TableName 获取对应数据库表名.

func (*Blog) TableNameWithPrefix

func (b *Blog) TableNameWithPrefix() string

func (*Blog) TableUnique

func (b *Blog) TableUnique() [][]string

多字段唯一键

type BlogResult

type BlogResult struct {
}

type Book

type Book struct {
	BookId int `orm:"pk;auto;unique;column(book_id)" json:"book_id"`
	// BookName 项目名称.
	BookName string `orm:"column(book_name);size(500)" json:"book_name"`
	//所属项目空间
	ItemId int `orm:"column(item_id);type(int);default(1)" json:"item_id"`
	// Identify 项目唯一标识.
	Identify string `orm:"column(identify);size(100);unique" json:"identify"`
	//是否是自动发布 0 否/1 是
	AutoRelease int `orm:"column(auto_release);type(int);default(0)" json:"auto_release"`
	//是否开启下载功能 0 是/1 否
	IsDownload int `orm:"column(is_download);type(int);default(0)" json:"is_download"`
	OrderIndex int `orm:"column(order_index);type(int);default(0)" json:"order_index"`
	// Description 项目描述.
	Description string `orm:"column(description);size(2000)" json:"description"`
	//发行公司
	Publisher string `orm:"column(publisher);size(500)" json:"publisher"`
	Label     string `orm:"column(label);size(500)" json:"label"`
	// PrivatelyOwned 项目私有: 0 公开/ 1 私有
	PrivatelyOwned int `orm:"column(privately_owned);type(int);default(0)" json:"privately_owned"`
	// 当项目是私有时的访问Token.
	PrivateToken string `orm:"column(private_token);size(500);null" json:"private_token"`
	//访问密码.
	BookPassword string `orm:"column(book_password);size(500);null" json:"book_password"`
	//状态:0 正常/1 已删除
	Status int `orm:"column(status);type(int);default(0)" json:"status"`
	//默认的编辑器.
	Editor string `orm:"column(editor);size(50)" json:"editor"`
	// DocCount 包含文档数量.
	DocCount int `orm:"column(doc_count);type(int)" json:"doc_count"`
	// CommentStatus 评论设置的状态:open 为允许所有人评论,closed 为不允许评论, group_only 仅允许参与者评论 ,registered_only 仅允许注册者评论.
	CommentStatus string `orm:"column(comment_status);size(20);default(open)" json:"comment_status"`
	CommentCount  int    `orm:"column(comment_count);type(int)" json:"comment_count"`
	//封面地址
	Cover string `orm:"column(cover);size(1000)" json:"cover"`
	//主题风格
	Theme string `orm:"column(theme);size(255);default(default)" json:"theme"`
	// CreateTime 创建时间 .
	CreateTime time.Time `orm:"type(datetime);column(create_time);auto_now_add" json:"create_time"`
	//每个文档保存的历史记录数量,0 为不限制
	HistoryCount int `orm:"column(history_count);type(int);default(0)" json:"history_count"`
	//是否启用分享,0启用/1不启用
	IsEnableShare int       `orm:"column(is_enable_share);type(int);default(0)" json:"is_enable_share"`
	MemberId      int       `orm:"column(member_id);size(100)" json:"member_id"`
	ModifyTime    time.Time `orm:"type(datetime);column(modify_time);null;auto_now" json:"modify_time"`
	Version       int64     `orm:"type(bigint);column(version)" json:"version"`
	//是否使用第一篇文章项目为默认首页,0 否/1 是
	IsUseFirstDocument int `orm:"column(is_use_first_document);type(int);default(0)" json:"is_use_first_document"`
	//是否开启自动保存:0 否/1 是
	AutoSave int `orm:"column(auto_save);type(tinyint);default(0)" json:"auto_save"`
}

Book struct .

func NewBook

func NewBook() *Book

func (*Book) Copy

func (book *Book) Copy(identify string) error

复制项目

func (*Book) Find

func (book *Book) Find(id int, cols ...string) (*Book, error)

func (*Book) FindByField

func (book *Book) FindByField(field string, value interface{}, cols ...string) ([]*Book, error)

根据指定字段查询结果集.

func (*Book) FindByFieldFirst

func (book *Book) FindByFieldFirst(field string, value interface{}) (*Book, error)

根据指定字段查询一个结果.

func (*Book) FindByIdentify

func (book *Book) FindByIdentify(identify string, cols ...string) (*Book, error)

根据项目标识查询项目

func (*Book) FindForHomeToPager

func (book *Book) FindForHomeToPager(pageIndex, pageSize, memberId int) (books []*BookResult, totalCount int, err error)

分页查找系统首页数据.

func (*Book) FindForLabelToPager

func (book *Book) FindForLabelToPager(keyword string, pageIndex, pageSize, memberId int) (books []*BookResult, totalCount int, err error)

分页全局搜索.

func (*Book) FindForRoleId

func (book *Book) FindForRoleId(bookId, memberId int) (conf.BookRole, error)

func (*Book) FindToPager

func (book *Book) FindToPager(pageIndex, pageSize, memberId int) (books []*BookResult, totalCount int, err error)

分页查询指定用户的项目

func (*Book) ImportBook

func (book *Book) ImportBook(zipPath string) error

导入项目

func (*Book) Insert

func (book *Book) Insert() error

添加一个项目

func (*Book) QueryTable

func (book *Book) QueryTable() orm.QuerySeter

func (*Book) ReleaseContent

func (book *Book) ReleaseContent(bookId int)

ReleaseContent 批量发布文档

func (*Book) ResetDocumentNumber

func (book *Book) ResetDocumentNumber(bookId int)

重置文档数量

func (*Book) String

func (book *Book) String() string

func (*Book) TableEngine

func (book *Book) TableEngine() string

TableEngine 获取数据使用的引擎.

func (*Book) TableName

func (book *Book) TableName() string

TableName 获取对应数据库表名.

func (*Book) TableNameWithPrefix

func (book *Book) TableNameWithPrefix() string

func (*Book) ThoroughDeleteBook

func (book *Book) ThoroughDeleteBook(id int) error

彻底删除项目.

func (*Book) Update

func (book *Book) Update(cols ...string) error

更新一个项目

type BookResult

type BookResult struct {
	BookId         int       `json:"book_id"`
	BookName       string    `json:"book_name"`
	ItemId         int       `json:"item_id"`
	ItemName       string    `json:"item_name"`
	Identify       string    `json:"identify"`
	OrderIndex     int       `json:"order_index"`
	Description    string    `json:"description"`
	Publisher      string    `json:"publisher"`
	PrivatelyOwned int       `json:"privately_owned"`
	PrivateToken   string    `json:"private_token"`
	BookPassword   string    `json:"book_password"`
	DocCount       int       `json:"doc_count"`
	CommentStatus  string    `json:"comment_status"`
	CommentCount   int       `json:"comment_count"`
	CreateTime     time.Time `json:"create_time"`
	CreateName     string    `json:"create_name"`
	RealName       string    `json:"real_name"`
	ModifyTime     time.Time `json:"modify_time"`
	Cover          string    `json:"cover"`
	Theme          string    `json:"theme"`
	Label          string    `json:"label"`
	MemberId       int       `json:"member_id"`
	Editor         string    `json:"editor"`
	AutoRelease    bool      `json:"auto_release"`
	HistoryCount   int       `json:"history_count"`

	//RelationshipId     int           `json:"relationship_id"`
	//TeamRelationshipId int           `json:"team_relationship_id"`
	RoleId             conf.BookRole `json:"role_id"`
	RoleName           string        `json:"role_name"`
	Status             int           `json:"status"`
	IsEnableShare      bool          `json:"is_enable_share"`
	IsUseFirstDocument bool          `json:"is_use_first_document"`

	LastModifyText   string `json:"last_modify_text"`
	IsDisplayComment bool   `json:"is_display_comment"`
	IsDownload       bool   `json:"is_download"`
	AutoSave         bool   `json:"auto_save"`
}

func NewBookResult

func NewBookResult() *BookResult

func (*BookResult) Converter

func (m *BookResult) Converter(sessionId string) (ConvertBookResult, error)

导出PDF、word等格式

func (*BookResult) ExportMarkdown

func (m *BookResult) ExportMarkdown(sessionId string) (string, error)

导出Markdown原始文件

func (*BookResult) FindByIdentify

func (m *BookResult) FindByIdentify(identify string, memberId int) (*BookResult, error)

根据项目标识查询项目以及指定用户权限的信息.

func (*BookResult) FindFirstDocumentByBookId

func (m *BookResult) FindFirstDocumentByBookId(bookId int) (*Document, error)

查询项目的第一篇文档

func (*BookResult) FindToPager

func (m *BookResult) FindToPager(pageIndex, pageSize int) (books []*BookResult, totalCount int, err error)

func (*BookResult) String

func (m *BookResult) String() string

func (*BookResult) ToBookResult

func (m *BookResult) ToBookResult(book Book) *BookResult

实体转换

type Comment

type Comment struct {
	CommentId int `orm:"pk;auto;unique;column(comment_id)" json:"comment_id"`
	Floor     int `orm:"column(floor);type(unsigned);default(0)" json:"floor"`
	BookId    int `orm:"column(book_id);type(int)" json:"book_id"`
	// DocumentId 评论所属的文档.
	DocumentId int `orm:"column(document_id);type(int)" json:"document_id"`
	// Author 评论作者.
	Author string `orm:"column(author);size(100)" json:"author"`
	//MemberId 评论用户ID.
	MemberId int `orm:"column(member_id);type(int)" json:"member_id"`
	// IPAddress 评论者的IP地址
	IPAddress string `orm:"column(ip_address);size(100)" json:"ip_address"`
	// 评论日期.
	CommentDate time.Time `orm:"type(datetime);column(comment_date);auto_now_add" json:"comment_date"`
	//Content 评论内容.
	Content string `orm:"column(content);size(2000)" json:"content"`
	// Approved 评论状态:0 待审核/1 已审核/2 垃圾评论/ 3 已删除
	Approved int `orm:"column(approved);type(int)" json:"approved"`
	// UserAgent 评论者浏览器内容
	UserAgent string `orm:"column(user_agent);size(500)" json:"user_agent"`
	// Parent 评论所属父级
	ParentId     int `orm:"column(parent_id);type(int);default(0)" json:"parent_id"`
	AgreeCount   int `orm:"column(agree_count);type(int);default(0)" json:"agree_count"`
	AgainstCount int `orm:"column(against_count);type(int);default(0)" json:"against_count"`
}

Comment struct

func NewComment

func NewComment() *Comment

func (*Comment) Find

func (m *Comment) Find(id int) (*Comment, error)

func (*Comment) Insert

func (m *Comment) Insert() error

Insert 添加一条评论.

func (*Comment) TableEngine

func (m *Comment) TableEngine() string

TableEngine 获取数据使用的引擎.

func (*Comment) TableName

func (m *Comment) TableName() string

TableName 获取对应数据库表名.

func (*Comment) TableNameWithPrefix

func (m *Comment) TableNameWithPrefix() string

func (*Comment) Update

func (m *Comment) Update(cols ...string) error

type CommentResult

type CommentResult struct {
	Comment
	Author       string `json:"author"`
	ReplyAccount string `json:"reply_account"`
}

func (*CommentResult) FindForDocumentToPager

func (m *CommentResult) FindForDocumentToPager(doc_id, page_index, page_size int) (comments []*CommentResult, totalCount int, err error)

type CommentVote

type CommentVote struct {
	VoteId          int       `orm:"column(vote_id);pk;auto;unique" json:"vote_id"`
	CommentId       int       `orm:"column(comment_id);type(int);index" json:"comment_id"`
	CommentMemberId int       `orm:"column(comment_member_id);type(int);index;default(0)" json:"comment_member_id"`
	VoteMemberId    int       `orm:"column(vote_member_id);type(int);index" json:"vote_member_id"`
	VoteState       int       `orm:"column(vote_state);type(int)" json:"vote_state"`
	CreateTime      time.Time `orm:"column(create_time);type(datetime);auto_now_add" json:"create_time"`
}

func NewCommentVote

func NewCommentVote() *CommentVote

func (*CommentVote) InsertOrUpdate

func (m *CommentVote) InsertOrUpdate() (*CommentVote, error)

func (*CommentVote) TableEngine

func (m *CommentVote) TableEngine() string

TableEngine 获取数据使用的引擎.

func (*CommentVote) TableName

func (m *CommentVote) TableName() string

TableName 获取对应数据库表名.

func (*CommentVote) TableNameWithPrefix

func (m *CommentVote) TableNameWithPrefix() string

func (*CommentVote) TableUnique

func (u *CommentVote) TableUnique() [][]string

type ConvertBookResult

type ConvertBookResult struct {
	PDFPath  string
	EpubPath string
	MobiPath string
	WordPath string
}

转换结果

type Dashboard

type Dashboard struct {
	BookNumber       int64 `json:"book_number"`
	DocumentNumber   int64 `json:"document_number"`
	MemberNumber     int64 `json:"member_number"`
	CommentNumber    int64 `json:"comment_number"`
	AttachmentNumber int64 `json:"attachment_number"`
}

func NewDashboard

func NewDashboard() *Dashboard

func (*Dashboard) Query

func (m *Dashboard) Query() *Dashboard

type Document

type Document struct {
	DocumentId   int    `orm:"pk;auto;unique;column(document_id)" json:"doc_id"`
	DocumentName string `orm:"column(document_name);size(500)" json:"doc_name"`
	// Identify 文档唯一标识
	Identify  string `orm:"column(identify);size(100);index;null;default(null)" json:"identify"`
	BookId    int    `orm:"column(book_id);type(int);index" json:"book_id"`
	ParentId  int    `orm:"column(parent_id);type(int);index;default(0)" json:"parent_id"`
	OrderSort int    `orm:"column(order_sort);default(0);type(int);index" json:"order_sort"`
	// Markdown markdown格式文档.
	Markdown string `orm:"column(markdown);type(text);null" json:"markdown"`
	// Release 发布后的Html格式内容.
	Release string `orm:"column(release);type(text);null" json:"release"`
	// Content 未发布的 Html 格式内容.
	Content    string    `orm:"column(content);type(text);null" json:"content"`
	CreateTime time.Time `orm:"column(create_time);type(datetime);auto_now_add" json:"create_time"`
	MemberId   int       `orm:"column(member_id);type(int)" json:"member_id"`
	ModifyTime time.Time `orm:"column(modify_time);type(datetime);auto_now" json:"modify_time"`
	ModifyAt   int       `orm:"column(modify_at);type(int)" json:"-"`
	Version    int64     `orm:"column(version);type(bigint);" json:"version"`
	//是否展开子目录:0 否/1 是 /2 空间节点,单击时展开下一级
	IsOpen     int           `orm:"column(is_open);type(int);default(0)" json:"is_open"`
	AttachList []*Attachment `orm:"-" json:"attach"`
}

Document struct.

func NewDocument

func NewDocument() *Document

func (*Document) CreateDocumentTreeForHtml

func (item *Document) CreateDocumentTreeForHtml(bookId, selectedId int) (string, error)

func (*Document) Find

func (item *Document) Find(id int) (*Document, error)

根据文档ID查询指定文档.

func (*Document) FindByIdentityFirst

func (item *Document) FindByIdentityFirst(identify string, bookId int) (*Document, error)

根据文档识别编号和项目id获取一篇文档

func (*Document) FindDocumentTree

func (item *Document) FindDocumentTree(bookId int) ([]*DocumentTree, error)

获取项目的文档树状结构

func (*Document) FindListByBookId

func (item *Document) FindListByBookId(bookId int) (docs []*Document, err error)

根据项目ID查询文档列表.

func (*Document) FromCacheById

func (item *Document) FromCacheById(id int) (*Document, error)

从缓存获取

func (*Document) FromCacheByIdentify

func (item *Document) FromCacheByIdentify(identify string, bookId int) (*Document, error)

根据文档标识从缓存中查询文档

func (*Document) InsertOrUpdate

func (item *Document) InsertOrUpdate(cols ...string) error

插入和更新文档.

func (*Document) IsExist

func (item *Document) IsExist(documentId int) bool

判断文章是否存在

func (*Document) Processor

func (item *Document) Processor() *Document

处理文档的外链,附件,底部编辑信息等.

func (*Document) PutToCache

func (item *Document) PutToCache()

将文档写入缓存

func (*Document) RecursiveDocument

func (item *Document) RecursiveDocument(docId int) error

递归删除一个文档.

func (*Document) ReleaseContent

func (item *Document) ReleaseContent() error

发布单篇文档

func (*Document) RemoveCache

func (item *Document) RemoveCache()

清除缓存

func (*Document) TableEngine

func (item *Document) TableEngine() string

TableEngine 获取数据使用的引擎.

func (*Document) TableName

func (item *Document) TableName() string

TableName 获取对应数据库表名.

func (*Document) TableNameWithPrefix

func (item *Document) TableNameWithPrefix() string

func (*Document) TableUnique

func (item *Document) TableUnique() [][]string

多字段唯一键

type DocumentHistory

type DocumentHistory struct {
	HistoryId    int       `orm:"column(history_id);pk;auto;unique" json:"history_id"`
	Action       string    `orm:"column(action);size(255)" json:"action"`
	ActionName   string    `orm:"column(action_name);size(255)" json:"action_name"`
	DocumentId   int       `orm:"column(document_id);type(int);index" json:"doc_id"`
	DocumentName string    `orm:"column(document_name);size(500)" json:"doc_name"`
	ParentId     int       `orm:"column(parent_id);type(int);index;default(0)" json:"parent_id"`
	Markdown     string    `orm:"column(markdown);type(text);null" json:"markdown"`
	Content      string    `orm:"column(content);type(text);null" json:"content"`
	MemberId     int       `orm:"column(member_id);type(int)" json:"member_id"`
	ModifyTime   time.Time `orm:"column(modify_time);type(datetime);auto_now" json:"modify_time"`
	ModifyAt     int       `orm:"column(modify_at);type(int)" json:"-"`
	Version      int64     `orm:"type(bigint);column(version)" json:"version"`
	IsOpen       int       `orm:"column(is_open);type(int);default(0)" json:"is_open"`
}

func NewDocumentHistory

func NewDocumentHistory() *DocumentHistory

func (*DocumentHistory) Clear

func (m *DocumentHistory) Clear(docId int) error

清空指定文档的历史.

func (*DocumentHistory) Delete

func (m *DocumentHistory) Delete(historyId, docId int) error

删除历史.

func (*DocumentHistory) Find

func (m *DocumentHistory) Find(id int) (*DocumentHistory, error)

func (*DocumentHistory) FindToPager

func (m *DocumentHistory) FindToPager(docId, pageIndex, pageSize int) (docs []*DocumentHistorySimpleResult, totalCount int, err error)

分页查询指定文档的历史.

func (*DocumentHistory) InsertOrUpdate

func (m *DocumentHistory) InsertOrUpdate() (history *DocumentHistory, err error)

func (*DocumentHistory) Restore

func (m *DocumentHistory) Restore(historyId, docId, uid int) error

恢复指定历史的文档.

func (*DocumentHistory) TableEngine

func (m *DocumentHistory) TableEngine() string

TableEngine 获取数据使用的引擎.

func (*DocumentHistory) TableName

func (m *DocumentHistory) TableName() string

TableName 获取对应数据库表名.

func (*DocumentHistory) TableNameWithPrefix

func (m *DocumentHistory) TableNameWithPrefix() string

type DocumentHistorySimpleResult

type DocumentHistorySimpleResult struct {
	HistoryId  int       `json:"history_id"`
	ActionName string    `json:"action_name"`
	MemberId   int       `json:"member_id"`
	Account    string    `json:"account"`
	ModifyAt   int       `json:"modify_at"`
	ModifyName string    `json:"modify_name"`
	ModifyTime time.Time `json:"modify_time"`
	Version    int64     `json:"version"`
}

type DocumentSearchResult

type DocumentSearchResult struct {
	DocumentId   int    `json:"doc_id"`
	DocumentName string `json:"doc_name"`
	// Identify 文档唯一标识
	Identify     string    `json:"identify"`
	Description  string    `json:"description"`
	Author       string    `json:"author"`
	ModifyTime   time.Time `json:"modify_time"`
	CreateTime   time.Time `json:"create_time"`
	BookId       int       `json:"book_id"`
	BookName     string    `json:"book_name"`
	BookIdentify string    `json:"book_identify"`
	SearchType   string    `json:"search_type"`
}

func NewDocumentSearchResult

func NewDocumentSearchResult() *DocumentSearchResult

func (*DocumentSearchResult) FindToPager

func (m *DocumentSearchResult) FindToPager(keyword string, pageIndex, pageSize, memberId int) (searchResult []*DocumentSearchResult, totalCount int, err error)

分页全局搜索.

func (*DocumentSearchResult) SearchDocument

func (m *DocumentSearchResult) SearchDocument(keyword string, bookId int) (docs []*DocumentSearchResult, err error)

项目内搜索.

type DocumentSelected

type DocumentSelected struct {
	Selected bool `json:"selected"`
	Opened   bool `json:"opened"`
	Disabled bool `json:"disabled"`
}

type DocumentTree

type DocumentTree struct {
	DocumentId   int                    `json:"id"`
	DocumentName string                 `json:"text"`
	ParentId     interface{}            `json:"parent"`
	Identify     string                 `json:"identify"`
	BookIdentify string                 `json:"-"`
	Version      int64                  `json:"version"`
	State        *DocumentSelected      `json:"-"`
	AAttrs       map[string]interface{} `json:"a_attr"`
}

type Error

type Error struct {
	// contains filtered or unexported fields
}

func NewError

func NewError(code int, message string) Error

func (Error) Code

func (e Error) Code() int

func (Error) Error

func (e Error) Error() string

type Itemsets

type Itemsets struct {
	ItemId      int       `orm:"column(item_id);pk;auto;unique" json:"item_id"`
	ItemName    string    `orm:"column(item_name);size(500)" json:"item_name"`
	ItemKey     string    `orm:"column(item_key);size(100);unique" json:"item_key"`
	Description string    `orm:"column(description);type(text);null" json:"description"`
	MemberId    int       `orm:"column(member_id);size(100)" json:"member_id"`
	CreateTime  time.Time `orm:"column(create_time);type(datetime);auto_now_add" json:"create_time"`
	ModifyTime  time.Time `orm:"column(modify_time);type(datetime);null;auto_now" json:"modify_time"`
	ModifyAt    int       `orm:"column(modify_at);type(int)" json:"modify_at"`

	BookNumber       int    `orm:"-" json:"book_number"`
	CreateTimeString string `orm:"-" json:"create_time_string"`
	CreateName       string `orm:"-" json:"create_name"`
}

项目空间

func NewItemsets

func NewItemsets() *Itemsets

func (*Itemsets) Delete

func (item *Itemsets) Delete(itemId int) (err error)

删除.

func (*Itemsets) Exist

func (item *Itemsets) Exist(itemId int) bool

func (*Itemsets) FindFirst

func (item *Itemsets) FindFirst(itemKey string) (*Itemsets, error)

func (*Itemsets) FindItemsetsByItemKey

func (item *Itemsets) FindItemsetsByItemKey(key string, pageIndex, pageSize, memberId int) (books []*BookResult, totalCount int, err error)

根据项目空间标识查询项目空间的项目列表.

func (*Itemsets) FindItemsetsByName

func (item *Itemsets) FindItemsetsByName(name string, limit int) (*SelectMemberResult, error)

根据项目空间名称查询.

func (*Itemsets) FindToPager

func (item *Itemsets) FindToPager(pageIndex, pageSize int) (list []*Itemsets, totalCount int, err error)

分页查询.

func (*Itemsets) First

func (item *Itemsets) First(itemId int) (*Itemsets, error)

func (*Itemsets) Include

func (item *Itemsets) Include() (*Itemsets, error)

func (*Itemsets) QueryTable

func (item *Itemsets) QueryTable() orm.QuerySeter

func (*Itemsets) Save

func (item *Itemsets) Save() (err error)

保存

func (*Itemsets) TableEngine

func (item *Itemsets) TableEngine() string

TableEngine 获取数据使用的引擎.

func (*Itemsets) TableName

func (item *Itemsets) TableName() string

TableName 获取对应数据库表名.

func (*Itemsets) TableNameWithPrefix

func (item *Itemsets) TableNameWithPrefix() string

type KeyValueItem

type KeyValueItem struct {
	Id   int    `json:"id"`
	Text string `json:"text"`
}

type Label

type Label struct {
	LabelId    int    `orm:"column(label_id);pk;auto;unique;" json:"label_id"`
	LabelName  string `orm:"column(label_name);size(50);unique" json:"label_name"`
	BookNumber int    `orm:"column(book_number)" json:"book_number"`
}

func NewLabel

func NewLabel() *Label

func (*Label) Delete

func (m *Label) Delete() error

删除标签

func (*Label) FindFirst

func (m *Label) FindFirst(field string, value interface{}) (*Label, error)

func (*Label) FindToPager

func (m *Label) FindToPager(pageIndex, pageSize int) (labels []*Label, totalCount int, err error)

分页查找标签.

func (*Label) InsertOrUpdate

func (m *Label) InsertOrUpdate(labelName string) error

插入或更新标签.

func (*Label) InsertOrUpdateMulti

func (m *Label) InsertOrUpdateMulti(labels string)

批量插入或更新标签.

func (*Label) TableEngine

func (m *Label) TableEngine() string

TableEngine 获取数据使用的引擎.

func (*Label) TableName

func (m *Label) TableName() string

TableName 获取对应数据库表名.

func (*Label) TableNameWithPrefix

func (m *Label) TableNameWithPrefix() string

type Logger

type Logger struct {
	LoggerId int64 `orm:"pk;auto;unique;column(log_id)" json:"log_id"`
	MemberId int   `orm:"column(member_id);type(int)" json:"member_id"`
	// 日志类别:operate 操作日志/ system 系统日志/ exception 异常日志 / document 文档操作日志
	Category     string    `orm:"column(category);size(255);default(operate)" json:"category"`
	Content      string    `orm:"column(content);type(text)" json:"content"`
	OriginalData string    `orm:"column(original_data);type(text)" json:"original_data"`
	PresentData  string    `orm:"column(present_data);type(text)" json:"present_data"`
	CreateTime   time.Time `orm:"type(datetime);column(create_time);auto_now_add" json:"create_time"`
	UserAgent    string    `orm:"column(user_agent);size(500)" json:"user_agent"`
	IPAddress    string    `orm:"column(ip_address);size(255)" json:"ip_address"`
}

Logger struct .

func NewLogger

func NewLogger() *Logger

func (*Logger) Add

func (m *Logger) Add() error

func (*Logger) TableEngine

func (m *Logger) TableEngine() string

TableEngine 获取数据使用的引擎.

func (*Logger) TableName

func (m *Logger) TableName() string

TableName 获取对应数据库表名.

func (*Logger) TableNameWithPrefix

func (m *Logger) TableNameWithPrefix() string

type Member

type Member struct {
	MemberId int    `orm:"pk;auto;unique;column(member_id)" json:"member_id"`
	Account  string `orm:"size(100);unique;column(account)" json:"account"`
	RealName string `orm:"size(255);column(real_name)" json:"real_name"`
	Password string `orm:"size(1000);column(password)" json:"-"`
	//认证方式: local 本地数据库 /ldap LDAP
	AuthMethod  string `orm:"column(auth_method);default(local);size(50);" json:"auth_method"`
	Description string `orm:"column(description);size(2000)" json:"description"`
	Email       string `orm:"size(100);column(email);unique" json:"email"`
	Phone       string `orm:"size(255);column(phone);null;default(null)" json:"phone"`
	Avatar      string `orm:"size(1000);column(avatar)" json:"avatar"`
	//用户角色:0 超级管理员 /1 管理员/ 2 普通用户 .
	Role          conf.SystemRole `orm:"column(role);type(int);default(1);index" json:"role"`
	RoleName      string          `orm:"-" json:"role_name"`
	Status        int             `orm:"column(status);type(int);default(0)" json:"status"` //用户状态:0 正常/1 禁用
	CreateTime    time.Time       `orm:"type(datetime);column(create_time);auto_now_add" json:"create_time"`
	CreateAt      int             `orm:"type(int);column(create_at)" json:"create_at"`
	LastLoginTime time.Time       `orm:"type(datetime);column(last_login_time);null" json:"last_login_time"`
}

func NewMember

func NewMember() *Member

func (*Member) Add

func (m *Member) Add() error

Add 添加一个用户.

func (*Member) Delete

func (m *Member) Delete(oldId int, newId int) error

删除一个用户.

func (*Member) Find

func (m *Member) Find(id int, cols ...string) (*Member, error)

func (*Member) FindByAccount

func (m *Member) FindByAccount(account string) (*Member, error)

根据账号查找用户.

func (*Member) FindByAccountList

func (m *Member) FindByAccountList(accounts ...string) ([]*Member, error)

批量查询用户

func (*Member) FindByFieldFirst

func (m *Member) FindByFieldFirst(field string, value interface{}) (*Member, error)

根据指定字段查找用户.

func (*Member) FindToPager

func (m *Member) FindToPager(pageIndex, pageSize int) ([]*Member, int, error)

分页查找用户.

func (*Member) IsAdministrator

func (m *Member) IsAdministrator() bool

func (*Member) Login

func (m *Member) Login(account string, password string) (*Member, error)

Login 用户登录.

func (*Member) ResolveRoleName

func (m *Member) ResolveRoleName()

func (*Member) TableEngine

func (m *Member) TableEngine() string

TableEngine 获取数据使用的引擎.

func (*Member) TableName

func (m *Member) TableName() string

TableName 获取对应数据库表名.

func (*Member) TableNameWithPrefix

func (m *Member) TableNameWithPrefix() string

func (*Member) Update

func (m *Member) Update(cols ...string) error

Update 更新用户信息.

func (*Member) Valid

func (m *Member) Valid(is_hash_password bool) error

校验用户.

type MemberRelationshipResult

type MemberRelationshipResult struct {
	MemberId       int             `json:"member_id"`
	Account        string          `json:"account"`
	RealName       string          `json:"real_name"`
	Description    string          `json:"description"`
	Email          string          `json:"email"`
	Phone          string          `json:"phone"`
	Avatar         string          `json:"avatar"`
	Role           conf.SystemRole `json:"role"`   //用户角色:0 管理员/ 1 普通用户
	Status         int             `json:"status"` //用户状态:0 正常/1 禁用
	CreateTime     time.Time       `json:"create_time"`
	CreateAt       int             `json:"create_at"`
	RelationshipId int             `json:"relationship_id"`
	BookId         int             `json:"book_id"`
	// RoleId 角色:0 创始人(创始人不能被移除) / 1 管理员/2 编辑者/3 观察者
	RoleId   conf.BookRole `json:"role_id"`
	RoleName string        `json:"role_name"`
}

func NewMemberRelationshipResult

func NewMemberRelationshipResult() *MemberRelationshipResult

func (*MemberRelationshipResult) FindForUsersByBookId

func (m *MemberRelationshipResult) FindForUsersByBookId(bookId, pageIndex, pageSize int) ([]*MemberRelationshipResult, int, error)

根据项目ID查询用户

func (*MemberRelationshipResult) FindNotJoinUsersByAccount

func (m *MemberRelationshipResult) FindNotJoinUsersByAccount(bookId, limit int, account string) ([]*Member, error)

查询指定文档中不存在的用户列表

func (*MemberRelationshipResult) FindNotJoinUsersByAccountOrRealName

func (m *MemberRelationshipResult) FindNotJoinUsersByAccountOrRealName(bookId, limit int, keyWord string) ([]*Member, error)

根据姓名以及用户名模糊查询指定文档中不存在的用户列表

func (*MemberRelationshipResult) FromMember

func (*MemberRelationshipResult) ResolveRoleName

func (m *MemberRelationshipResult) ResolveRoleName() *MemberRelationshipResult

type MemberToken

type MemberToken struct {
	TokenId   int       `orm:"column(token_id);pk;auto;unique" json:"token_id"`
	MemberId  int       `orm:"column(member_id);type(int)" json:"member_id"`
	Token     string    `orm:"column(token);size(150);index" json:"token"`
	Email     string    `orm:"column(email);size(255)" json:"email"`
	IsValid   bool      `orm:"column(is_valid)" json:"is_valid"`
	ValidTime time.Time `orm:"column(valid_time);null" json:"valid_time"`
	SendTime  time.Time `orm:"column(send_time);auto_now_add;type(datetime)" json:"send_time"`
}

func NewMemberToken

func NewMemberToken() *MemberToken

func (*MemberToken) FindByFieldFirst

func (m *MemberToken) FindByFieldFirst(field string, value interface{}) (*MemberToken, error)

func (*MemberToken) FindSendCount

func (m *MemberToken) FindSendCount(mail string, start_time time.Time, end_time time.Time) (int, error)

func (*MemberToken) InsertOrUpdate

func (m *MemberToken) InsertOrUpdate() (*MemberToken, error)

func (*MemberToken) TableEngine

func (m *MemberToken) TableEngine() string

TableEngine 获取数据使用的引擎.

func (*MemberToken) TableName

func (m *MemberToken) TableName() string

TableName 获取对应数据库表名.

func (*MemberToken) TableNameWithPrefix

func (m *MemberToken) TableNameWithPrefix() string

type Migration

type Migration struct {
	MigrationId int       `orm:"column(migration_id);pk;auto;unique;" json:"migration_id"`
	Name        string    `orm:"column(name);size(500)" json:"name"`
	Statements  string    `orm:"column(statements);type(text);null" json:"statements"`
	Status      string    `orm:"column(status);default(update)" json:"status"`
	CreateTime  time.Time `orm:"column(create_time);type(datetime);auto_now_add" json:"create_time"`
	Version     int64     `orm:"type(bigint);column(version);unique" json:"version"`
}

func NewMigration

func NewMigration() *Migration

func (*Migration) FindFirst

func (m *Migration) FindFirst() (*Migration, error)

func (*Migration) TableEngine

func (m *Migration) TableEngine() string

TableEngine 获取数据使用的引擎.

func (*Migration) TableName

func (m *Migration) TableName() string

TableName 获取对应数据库表名.

func (*Migration) TableNameWithPrefix

func (m *Migration) TableNameWithPrefix() string

type Model

type Model struct {
}

type Option

type Option struct {
	OptionId    int    `orm:"column(option_id);pk;auto;unique;" json:"option_id"`
	OptionTitle string `orm:"column(option_title);size(500)" json:"option_title"`
	OptionName  string `orm:"column(option_name);unique;size(80)" json:"option_name"`
	OptionValue string `orm:"column(option_value);type(text);null" json:"option_value"`
	Remark      string `orm:"column(remark);type(text);null" json:"remark"`
}

Option struct .

func NewOption

func NewOption() *Option

func (*Option) All

func (p *Option) All() ([]*Option, error)

func (*Option) Find

func (p *Option) Find(id int) (*Option, error)

func (*Option) FindByKey

func (p *Option) FindByKey(key string) (*Option, error)

func (*Option) Init

func (m *Option) Init() error

func (*Option) InsertMulti

func (p *Option) InsertMulti(option ...Option) error

func (*Option) InsertOrUpdate

func (p *Option) InsertOrUpdate() error

func (*Option) TableEngine

func (m *Option) TableEngine() string

TableEngine 获取数据使用的引擎.

func (*Option) TableName

func (m *Option) TableName() string

TableName 获取对应数据库表名.

func (*Option) TableNameWithPrefix

func (m *Option) TableNameWithPrefix() string

type Relationship

type Relationship struct {
	RelationshipId int `orm:"pk;auto;unique;column(relationship_id)" json:"relationship_id"`
	MemberId       int `orm:"column(member_id);type(int)" json:"member_id"`
	BookId         int `orm:"column(book_id);type(int)" json:"book_id"`
	// RoleId 角色:0 创始人(创始人不能被移除) / 1 管理员/2 编辑者/3 观察者
	RoleId conf.BookRole `orm:"column(role_id);type(int)" json:"role_id"`
}

func NewRelationship

func NewRelationship() *Relationship

func (*Relationship) DeleteByBookIdAndMemberId

func (m *Relationship) DeleteByBookIdAndMemberId(book_id, member_id int) error

func (*Relationship) Find

func (m *Relationship) Find(id int) (*Relationship, error)

func (*Relationship) FindByBookIdAndMemberId

func (m *Relationship) FindByBookIdAndMemberId(book_id, member_id int) (*Relationship, error)

func (*Relationship) FindForRoleId

func (m *Relationship) FindForRoleId(bookId, memberId int) (conf.BookRole, error)

func (*Relationship) FindFounder

func (m *Relationship) FindFounder(book_id int) (*Relationship, error)

查询指定项目的创始人.

func (*Relationship) Insert

func (m *Relationship) Insert() error

func (*Relationship) QueryTable

func (m *Relationship) QueryTable() orm.QuerySeter

func (*Relationship) TableEngine

func (m *Relationship) TableEngine() string

TableEngine 获取数据使用的引擎.

func (*Relationship) TableName

func (m *Relationship) TableName() string

TableName 获取对应数据库表名.

func (*Relationship) TableNameWithPrefix

func (m *Relationship) TableNameWithPrefix() string

func (*Relationship) TableUnique

func (m *Relationship) TableUnique() [][]string

联合唯一键

func (*Relationship) Transfer

func (m *Relationship) Transfer(book_id, founder_id, receive_id int) error

func (*Relationship) Update

func (m *Relationship) Update() error

func (*Relationship) UpdateRoleId

func (m *Relationship) UpdateRoleId(bookId, memberId int, roleId conf.BookRole) (*Relationship, error)

type SelectMemberResult

type SelectMemberResult struct {
	Result []KeyValueItem `json:"results"`
}

type Team

type Team struct {
	TeamId      int       `orm:"column(team_id);pk;auto;unique;" json:"team_id"`
	TeamName    string    `orm:"column(team_name);size(255)" json:"team_name"`
	MemberId    int       `orm:"column(member_id);type(int);" json:"member_id"`
	IsDelete    bool      `orm:"column(is_delete);default(0)" json:"is_delete"`
	CreateTime  time.Time `orm:"column(create_time);type(datetime);auto_now_add" json:"create_time"`
	MemberCount int       `orm:"-" json:"member_count"`
	BookCount   int       `orm:"-" json:"book_count"`
	MemberName  string    `orm:"-" json:"member_name"`
}

团队.

func NewTeam

func NewTeam() *Team

func (*Team) Delete

func (t *Team) Delete(id int) (err error)

func (*Team) FindToPager

func (t *Team) FindToPager(pageIndex, pageSize int) (list []*Team, totalCount int, err error)

分页查询团队.

func (*Team) First

func (t *Team) First(id int, cols ...string) (*Team, error)

查询一个团队.

func (*Team) Include

func (t *Team) Include()

func (*Team) Save

func (t *Team) Save(cols ...string) (err error)

更新或添加一个团队.

func (*Team) TableEngine

func (t *Team) TableEngine() string

TableEngine 获取数据使用的引擎.

func (*Team) TableName

func (t *Team) TableName() string

TableName 获取对应数据库表名.

func (*Team) TableNameWithPrefix

func (t *Team) TableNameWithPrefix() string

type TeamMember

type TeamMember struct {
	TeamMemberId int `orm:"column(team_member_id);pk;auto;unique;" json:"team_member_id"`
	TeamId       int `orm:"column(team_id);type(int)" json:"team_id"`
	MemberId     int `orm:"column(member_id);type(int)" json:"member_id"`
	// RoleId 角色:0 创始人(创始人不能被移除) / 1 管理员/2 编辑者/3 观察者
	RoleId   conf.BookRole `orm:"column(role_id);type(int)" json:"role_id"`
	RoleName string        `orm:"-" json:"role_name"`
	Account  string        `orm:"-" json:"account"`
	RealName string        `orm:"-" json:"real_name"`
	Avatar   string        `orm:"-" json:"avatar"`
}

func NewTeamMember

func NewTeamMember() *TeamMember

func (*TeamMember) ChangeRoleId

func (m *TeamMember) ChangeRoleId(teamId int, memberId int, roleId conf.BookRole) (member *TeamMember, err error)

func (*TeamMember) Delete

func (m *TeamMember) Delete(id int) (err error)

删除一个团队用户.

func (*TeamMember) FindByBookIdAndMemberId

func (m *TeamMember) FindByBookIdAndMemberId(bookId, memberId int) (*TeamMember, error)

func (*TeamMember) FindFirst

func (m *TeamMember) FindFirst(teamId, memberId int) (*TeamMember, error)

查询团队中指定的用户.

func (*TeamMember) FindNotJoinMemberByAccount

func (m *TeamMember) FindNotJoinMemberByAccount(teamId int, account string, limit int) (*SelectMemberResult, error)

查询未加入团队的用户。

func (*TeamMember) FindToPager

func (m *TeamMember) FindToPager(teamId, pageIndex, pageSize int) (list []*TeamMember, totalCount int, err error)

分页查询团队用户.

func (*TeamMember) First

func (m *TeamMember) First(id int, cols ...string) (*TeamMember, error)

func (*TeamMember) Include

func (m *TeamMember) Include() *TeamMember

查询关联数据.

func (*TeamMember) QueryTable

func (m *TeamMember) QueryTable() orm.QuerySeter

func (*TeamMember) Save

func (m *TeamMember) Save(cols ...string) (err error)

更新或插入团队用户.

func (*TeamMember) TableEngine

func (m *TeamMember) TableEngine() string

TableEngine 获取数据使用的引擎.

func (*TeamMember) TableName

func (m *TeamMember) TableName() string

TableName 获取对应数据库表名.

func (*TeamMember) TableNameWithPrefix

func (m *TeamMember) TableNameWithPrefix() string

func (*TeamMember) TableUnique

func (m *TeamMember) TableUnique() [][]string

联合唯一键

type TeamRelationship

type TeamRelationship struct {
	TeamRelationshipId int       `orm:"column(team_relationship_id);pk;auto;unique;" json:"team_relationship_id"`
	BookId             int       `orm:"column(book_id)" json:"book_id"`
	TeamId             int       `orm:"column(team_id)" json:"team_id"`
	CreateTime         time.Time `orm:"column(create_time);type(datetime);auto_now_add" json:"create_time"`
	TeamName           string    `orm:"-" json:"team_name"`
	MemberCount        int       `orm:"-" json:"member_count"`
	BookMemberId       int       `orm:"-" json:"book_member_id"`
	BookMemberName     string    `orm:"-" json:"book_member_name"`
	BookName           string    `orm:"-" json:"book_name"`
}

func NewTeamRelationship

func NewTeamRelationship() *TeamRelationship

func (*TeamRelationship) Delete

func (m *TeamRelationship) Delete(teamRelId int) (err error)

func (*TeamRelationship) DeleteByBookId

func (m *TeamRelationship) DeleteByBookId(bookId int, teamId int) error

删除指定项目的指定团队.

func (*TeamRelationship) FindByBookId

func (m *TeamRelationship) FindByBookId(bookId int, teamId int) (*TeamRelationship, error)

查找指定项目的指定团队.

func (*TeamRelationship) FindByBookToPager

func (m *TeamRelationship) FindByBookToPager(bookId, pageIndex, pageSize int) (list []*TeamRelationship, totalCount int, err error)

查询指定项目的团队.

func (*TeamRelationship) FindNotJoinBookByBookIdentify

func (m *TeamRelationship) FindNotJoinBookByBookIdentify(bookId int, teamName string, limit int) (*SelectMemberResult, error)

查找指定项目中未加入的团队.

func (*TeamRelationship) FindNotJoinBookByName

func (m *TeamRelationship) FindNotJoinBookByName(teamId int, bookName string, limit int) (*SelectMemberResult, error)

查询未加入团队的项目.

func (*TeamRelationship) FindToPager

func (m *TeamRelationship) FindToPager(teamId, pageIndex, pageSize int) (list []*TeamRelationship, totalCount int, err error)

分页查询团队项目.

func (*TeamRelationship) First

func (m *TeamRelationship) First(teamId int, cols ...string) (*TeamRelationship, error)

func (*TeamRelationship) Include

func (m *TeamRelationship) Include() (*TeamRelationship, error)

加载附加数据.

func (*TeamRelationship) QueryTable

func (m *TeamRelationship) QueryTable() orm.QuerySeter

func (*TeamRelationship) Save

func (m *TeamRelationship) Save(cols ...string) (err error)

保存团队项目.

func (*TeamRelationship) TableEngine

func (m *TeamRelationship) TableEngine() string

TableEngine 获取数据使用的引擎.

func (*TeamRelationship) TableName

func (m *TeamRelationship) TableName() string

TableName 获取对应数据库表名.

func (*TeamRelationship) TableNameWithPrefix

func (m *TeamRelationship) TableNameWithPrefix() string

func (*TeamRelationship) TableUnique

func (m *TeamRelationship) TableUnique() [][]string

联合唯一键

type Template

type Template struct {
	TemplateId   int    `orm:"column(template_id);pk;auto;unique;" json:"template_id"`
	TemplateName string `orm:"column(template_name);size(500);" json:"template_name"`
	MemberId     int    `orm:"column(member_id);index" json:"member_id"`
	BookId       int    `orm:"column(book_id);index" json:"book_id"`
	BookName     string `orm:"-" json:"book_name"`
	//是否是全局模板:0 否/1 是; 全局模板在所有项目中都可以使用;否则只能在创建模板的项目中使用
	IsGlobal        int       `orm:"column(is_global);default(0)" json:"is_global"`
	TemplateContent string    `orm:"column(template_content);type(text);null" json:"template_content"`
	CreateTime      time.Time `orm:"column(create_time);type(datetime);auto_now_add" json:"create_time"`
	CreateName      string    `orm:"-" json:"create_name"`
	ModifyTime      time.Time `orm:"column(modify_time);type(datetime);auto_now" json:"modify_time"`
	ModifyAt        int       `orm:"column(modify_at);type(int)" json:"-"`
	ModifyName      string    `orm:"-" json:"modify_name"`
	Version         int64     `orm:"type(bigint);column(version)" json:"version"`
}

func NewTemplate

func NewTemplate() *Template

func (*Template) Delete

func (t *Template) Delete(templateId int, memberId int) error

删除一个模板

func (*Template) Find

func (t *Template) Find(templateId int) (*Template, error)

查询指定ID的模板

func (*Template) FindAllByBookId

func (t *Template) FindAllByBookId(bookId int) ([]*Template, error)

查询指定项目所有可用模板列表.

func (*Template) FindByBookId

func (t *Template) FindByBookId(bookId int) ([]*Template, error)

查询属于指定项目的模板.

func (*Template) Preload

func (t *Template) Preload() *Template

预加载一些数据

func (*Template) Save

func (t *Template) Save(cols ...string) (err error)

添加或更新模板

func (*Template) TableEngine

func (m *Template) TableEngine() string

TableEngine 获取数据使用的引擎.

func (*Template) TableName

func (m *Template) TableName() string

TableName 获取对应数据库表名.

func (*Template) TableNameWithPrefix

func (m *Template) TableNameWithPrefix() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL