Documentation ¶
Index ¶
- func Close() error
- func CloseQuestion() (err error)
- func CreateItem(repo *Repository, item *Item) error
- func CreateItemLiker(repo *Repository, projectId, itemId, userId uint64) error
- func CreateLikeItem(repo *Repository, item *LikeItem) error
- func CreateQuestion() (err error)
- func DataBase() *gorm.DB
- func DeleteItem(repo *Repository, itemID uint64) error
- func DeleteItemLiker(repo *Repository, projectId, itemId, userId uint64) error
- func DeleteLikeItem(repo *Repository, itemID uint64) error
- func DeleteQuestion() (err error)
- func EditQuestion() (err error)
- func GetActiveListByActiveType(creatorID uint64, activeType uint) (*[]*Active, error)
- func GetActiveListByTimeRange(start time.Time, end time.Time) (*[]*Active, error)
- func GetAcviteByGroupID(groupID uint64) (*[]*Active, error)
- func GetAcviteByProjectID(projectID uint64) (*[]*Active, error)
- func GetAcviteByUserID(userID uint64) (*[]*Active, error)
- func GetCommentByUserID(userID uint64) (*[]*Comment, error)
- func GetCommentListByItem(userID uint64, activeType uint) (*[]*Comment, error)
- func GetCommentListByTimeRange(start time.Time, end time.Time) (*[]*Comment, error)
- func GetQuestion() (err error)
- func GetQuestionByTags() (err error)
- func GetQuestionByTitle() (err error)
- func Init(uname, pwd, dbname string) error
- func IsUserAuthExist(account string) bool
- func StartWatchingProject(userID, groupID, projectId uint64) error
- func StopWatchingProject(userID, groupID, projectId uint64) error
- func UpdateItemTags(repo *Repository, itemID uint64, tags string) error
- func UpdateItemTitle(repo *Repository, itemID uint64, title string) error
- func UpdateItemVisable(repo *Repository, itemID uint64, vtype api.VisibleType) error
- type Active
- type Auth
- func (a *Auth) ConfirmAuth() error
- func (a *Auth) CreateWithEmail() error
- func (a *Auth) CreateWithPhone() error
- func (a *Auth) Delete() error
- func (a *Auth) GetByEmail() error
- func (a *Auth) GetByPhone() error
- func (a *Auth) GetByUID() error
- func (a Auth) TableName() string
- func (a *Auth) UpdatePwd() error
- type Base
- type ChatSetting
- type Comment
- type Group
- func (g *Group) Create() error
- func (g *Group) Delete() error
- func (g *Group) GetByID() error
- func (g *Group) GetByName() error
- func (g Group) TableName() string
- func (g *Group) UpdateAll() error
- func (g *Group) UpdateAvatar() error
- func (g *Group) UpdateDesc() error
- func (g *Group) UpdateGroupType() error
- type GroupMember
- type IDBase
- type Item
- func GetItem(repo *Repository, itemID uint64) (*Item, error)
- func GetItemByGroup(repo *Repository, grouId uint64, offset, number int) ([]*Item, error)
- func GetItemByProject(repo *Repository, projectID uint64, offset, number int) ([]*Item, error)
- func GetItemByProjectAndCreator(repo *Repository, projectID uint64, userID uint64, offset, number int) ([]*Item, error)
- func GetItemByTitle(repo *Repository, title string) (*Item, error)
- func GetItemByUser(repo *Repository, userId uint64, offset, number int) ([]*Item, error)
- func GetItemsByType(repo *Repository, itemType api.ItemType) ([]*Item, error)
- type ItemLiker
- type LikeItem
- type Project
- func GeGroupProjectListByCreator(groupID int, creatorID int, offset, number int) (list []*Project, err error)
- func GetAllProjects(offset, number int) (list []*Project, err error)
- func GetGroupProjectListByName(groupID int, name string, offset, number int) (list []*Project, err error)
- func GetGroupProjectListByOwner(groupID int, ownerID int, offset, number int) (list []*Project, err error)
- func GetGroupProjects(groupID int64, offset, number int) (list []*Project, err error)
- func GetProjectListByCreator(creatorID int, offset, number int) (list []*Project, err error)
- func GetProjectListByName(name string, offset, number int) (list []*Project, err error)
- func GetProjectListByOwner(ownerID int, offset, number int) (list []*Project, err error)
- func GetUserWatchingProjects(userId int64, number, offset int) (list []*Project, err error)
- func (p *Project) Create() error
- func (p *Project) DecreaseWatcher() error
- func (p *Project) Delete() error
- func (p *Project) Get() error
- func (p *Project) GetProfile() error
- func (p *Project) IncreaseWatcher() error
- func (p Project) TableName() string
- func (p *Project) UpdateAchieve() error
- func (p *Project) UpdateDesc() error
- func (p *Project) UpdateIsClose() error
- func (p *Project) UpdateIsPrivate() error
- func (p *Project) UpdateProfile() error
- func (p *Project) UpdateTitle() error
- type ProjectProfile
- type ProjectWatcher
- type Question
- type Repository
- type Tags
- type Team
- type User
- func (u *User) Create() error
- func (u *User) Delete() error
- func (u *User) GetByEmail() error
- func (u *User) GetById() error
- func (u *User) GetByName() error
- func (u *User) GetByPhone() error
- func (u User) TableName() string
- func (u *User) UpdateAll() error
- func (u *User) UpdateAvatar() error
- func (u *User) UpdateBio() error
- func (u *User) UpdateName() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CloseQuestion ¶
func CloseQuestion() (err error)
func CreateItem ¶
func CreateItem(repo *Repository, item *Item) error
func CreateItemLiker ¶
func CreateItemLiker(repo *Repository, projectId, itemId, userId uint64) error
func CreateLikeItem ¶
func CreateLikeItem(repo *Repository, item *LikeItem) error
func CreateQuestion ¶
func CreateQuestion() (err error)
func DeleteItem ¶
func DeleteItem(repo *Repository, itemID uint64) error
func DeleteItemLiker ¶
func DeleteItemLiker(repo *Repository, projectId, itemId, userId uint64) error
func DeleteLikeItem ¶
func DeleteLikeItem(repo *Repository, itemID uint64) error
func DeleteQuestion ¶
func DeleteQuestion() (err error)
func EditQuestion ¶
func EditQuestion() (err error)
func GetAcviteByGroupID ¶
func GetAcviteByProjectID ¶
func GetAcviteByUserID ¶
func GetCommentByUserID ¶
func GetCommentListByItem ¶
func GetQuestion ¶
func GetQuestion() (err error)
func GetQuestionByTags ¶
func GetQuestionByTags() (err error)
func GetQuestionByTitle ¶
func GetQuestionByTitle() (err error)
func IsUserAuthExist ¶
func StartWatchingProject ¶
func StopWatchingProject ¶
func UpdateItemTags ¶
func UpdateItemTags(repo *Repository, itemID uint64, tags string) error
func UpdateItemTitle ¶
func UpdateItemTitle(repo *Repository, itemID uint64, title string) error
func UpdateItemVisable ¶
func UpdateItemVisable(repo *Repository, itemID uint64, vtype api.VisibleType) error
Types ¶
type Active ¶
type Active struct { IDBase UserId uint64 `json:"user_id,omitempty"` ActiveType api.ActiveType `json:"active_type,omitempty"` ItemID uint64 `json:"item_id,omitempty"` ProjectID uint64 `json:"project_id,omitempty"` GroupID uint64 `json:"group_id,omitempty"` }
Active
加载用户自己的活动记录 加载一个project的用户活动记录 加载用户的开放project的活动记录 加载一个group内的public project的活动记录
type Auth ¶
type Auth struct { IDBase UID uint64 `json:"uid,omitempty" gorm:"unique_index,column:uid"` Email string `json:"email,omitempty" gorm:"unique_index"` Phone string `json:"phone,omitempty" gorm:"unique_index"` Password string `json:"-" gorm:"password"` Salt string `json:"-" gorm:"salt"` IsValid bool `json:"is_valid,omitempty"` AuthType api.AuthType `json:"auth_type,omitempty" gorm:"authtype"` Confirmed bool `json:"confirmed,omitempty"` }
func (*Auth) ConfirmAuth ¶
func (*Auth) CreateWithEmail ¶
func (*Auth) CreateWithPhone ¶
func (*Auth) GetByEmail ¶
func (*Auth) GetByPhone ¶
type ChatSetting ¶
type ChatSetting int
const ( NoLimit ChatSetting = 0 AtleastOneGroup ChatSetting = 1 AtleastThreeGroup ChatSetting = 2 Forbiden ChatSetting = 4 )
type Comment ¶
type Comment struct { IDBase UserID uint64 `json:"user_id,omitempty"` GroupID uint64 `json:"group_id,omitempty"` ProjectID uint64 `json:"project_id,omitempty"` ItemID int `json:"item_id,omitempty"` PreID uint64 `json:"pre_id,omitempty"` Content []byte `json:"content,omitempty"` Tags string `json:"tags,omitempty"` }
Comment
用户的评论,如果用户的活动是评论的话,评论会被加载 评论可以针对: 视频,图片,短说,长文,音乐,项目,问题(?暂时可以不做)
func (*Comment) GetComment ¶
func (*Comment) UpdateContent ¶
type Group ¶
type Group struct { IDBase Name string `json:"name,omitempty"` ShortDesc string `json:"short_desc,omitempty"` Gtype string `json:"gtype,omitempty"` CreatorID uint64 `json:"creator_id,omitempty"` OwnerID uint64 `json:"owner_id,omitempty"` Members uint64 `json:"members,omitempty"` VisableType api.VisibleType `json:"visable_type,omitempty"` Description string `json:"description,omitempty"` Avatar string `json:"avatar,omitempty"` IsDefault bool `json:"is_default,omitempty"` }
用户有默认的自己的一个group,叫做场地或者空间 Group 用户参与的组织: 1.类似于一个大家庭,一个小家庭,情侣的二人世界 2.学校,学院,系,实验室,班级,同学合作小组, 3.一些关系比较近的大学校友同学,或者一些开放组织 4.一些公共组织,类似于气候变化,共同地理位置 5.一些大型公司,或者对抗大型公司恶性事件而结成的组织 6.私密学术讨论组织
func GetUserDefaultGroup ¶
func GetUserJoinedGroups ¶
GetUserFollowedGroups
func (*Group) UpdateAvatar ¶
func (*Group) UpdateDesc ¶
func (*Group) UpdateGroupType ¶
type GroupMember ¶
type GroupMember struct { IDBase GroupID uint64 `json:"group_id,omitempty"` UserID uint64 `json:"user_id,omitempty"` }
func GetGroupMembers ¶
func GetGroupMembers(groupID int, offset, number int) (list []*GroupMember, err error)
func (*GroupMember) Create ¶
func (g *GroupMember) Create() error
func (*GroupMember) Delete ¶
func (g *GroupMember) Delete() error
func (*GroupMember) IsInGroup ¶
func (g *GroupMember) IsInGroup() (bool, error)
func (GroupMember) TableName ¶
func (g GroupMember) TableName() string
type Item ¶
type Item struct { IDBase GroupID uint64 `json:"group_id,omitempty"` ProjectID uint64 `json:"project_id,omitempty"` UserID uint64 `json:"user_id,omitempty"` Visable api.VisibleType `json:"visable,omitempty"` Title string `json:"title,omitempty"` Description string `json:"description,omitempty"` ItemType api.ItemType `json:"item_type,omitempty"` Content string `json:"content,omitempty"` Tags string `json:"tags,omitempty"` LikeCount uint64 `json:"like_count,omitempty"` }
内容承载的item: 图片,文字,视频,音乐
func GetItemByGroup ¶
func GetItemByGroup(repo *Repository, grouId uint64, offset, number int) ([]*Item, error)
func GetItemByProject ¶
func GetItemByProject(repo *Repository, projectID uint64, offset, number int) ([]*Item, error)
func GetItemByTitle ¶
func GetItemByTitle(repo *Repository, title string) (*Item, error)
func GetItemByUser ¶
func GetItemByUser(repo *Repository, userId uint64, offset, number int) ([]*Item, error)
func GetItemsByType ¶
func GetItemsByType(repo *Repository, itemType api.ItemType) ([]*Item, error)
type LikeItem ¶
type LikeItem struct { IDBase UserID uint64 `json:"user_id,omitempty"` GroupID uint64 `json:"group_id,omitempty"` ProjectID uint64 `json:"project_id,omitempty"` ItemID uint64 `json:"item_id,omitempty"` LikeType uint64 `json:"like_type,omitempty"` }
func GetLikeItem ¶
func GetLikeItem(repo *Repository, itemID uint64) (*LikeItem, error)
func GetLiteItemByProjectAndUser ¶
func GetLiteItemByProjectAndUser(repo *Repository, projectID int, userID int) (list []*LikeItem, err error)
type Project ¶
type Project struct { IDBase Name string `json:"name,omitempty"` Tilte string `json:"tilte,omitempty"` ShortDesc string `json:"short_desc,omitempty"` ProjectType int `json:"project_type,omitempty"` CreatorID uint64 `json:"creator_id,omitempty"` OwnerID uint64 `json:"owner_id,omitempty"` GroupID uint64 `json:"group_id,omitempty"` ProjectProfile }
项目,或者说事件流; 1.包含多种内容 2.项目里可以开放问题(暂时可以不做)
func GetAllProjects ¶
func GetGroupProjects ¶
func GetProjectListByCreator ¶
func GetProjectListByName ¶
func GetProjectListByOwner ¶
func GetUserWatchingProjects ¶
func (*Project) DecreaseWatcher ¶
func (*Project) GetProfile ¶
func (*Project) IncreaseWatcher ¶
func (*Project) UpdateAchieve ¶
func (*Project) UpdateDesc ¶
func (*Project) UpdateIsClose ¶
func (*Project) UpdateIsPrivate ¶
func (*Project) UpdateProfile ¶
func (*Project) UpdateTitle ¶
type ProjectProfile ¶
type ProjectProfile struct { Description string `json:"description,omitempty"` Avatar string `json:"avatar,omitempty"` WatchingCount uint64 `json:"watching_count,omitempty"` InvolvedCount uint64 `json:"involved_count,omitempty"` Visable api.VisibleType `json:"visable,omitempty"` IsAchieve bool `json:"is_achieve,omitempty"` IsClose bool `json:"is_close,omitempty"` IsPrivate bool `json:"is_private,omitempty"` }
type ProjectWatcher ¶
type ProjectWatcher struct { IDBase GroupID uint64 `json:"group_id,omitempty"` ProjectID uint64 `json:"project_id,omitempty"` UserID uint64 `json:"user_id,omitempty"` }
func (ProjectWatcher) TableName ¶
func (p ProjectWatcher) TableName() string
type Question ¶
type Question struct { IDBase UserID uint64 `json:"user_id,omitempty"` GroupID uint64 `json:"group_id,omitempty"` ProjectID uint64 `json:"project_id,omitempty"` Tital string `json:"tital,omitempty"` Content string `json:"description,omitempty"` Tags uint64 `json:"tags,omitempty"` RefId uint64 `json:"ref_id,omitempty"` }
base on project
func GetProjectQuestions ¶
type Repository ¶
type Repository struct { Ctx context.Context UserID uint64 // contains filtered or unexported fields }
func NewRepository ¶
func NewRepository(ctx context.Context) *Repository
func (*Repository) DB ¶
func (r *Repository) DB() *gorm.DB
type Tags ¶
type Tags struct { IDBase UserId uint64 `json:"user_id,omitempty"` ItemID uint64 `json:"item_id,omitempty"` ProjectID uint64 `json:"project_id,omitempty"` GroupID uint64 `json:"group_id,omitempty"` Title string `json:"title,omitempty"` Desc string `json:"desc,omitempty"` DisAble bool `json:"disable,omitempty"` }
func GetTagsByGroup ¶
func GetTagsByProject ¶
func GetTagsByTitleInGroup ¶
func GetTagsByTitleInProject ¶
type Team ¶
type Team struct { IDBase UserId uint64 `json:"user_id,omitempty"` GroupID uint64 `json:"group_id,omitempty"` Title string `json:"title,omitempty"` Desc string `json:"desc,omitempty"` DisAble bool `json:"disable,omitempty"` Expired int64 `json:"expired,omitempty"` }
team才可以实时聊天,但是team中的人员不可以互相加好友 team属于一个group,team就类似于协程池一样的东西,一起协作做一件事情
func GetTeamsByCreator ¶
func GetTeamsByName ¶
func (*Team) CreateTeam ¶
func (*Team) DeleteTeam ¶
func (*Team) UpdateTeam ¶
type User ¶
type User struct { IDBase `json:"id_base,omitempty"` Name string `json:"name,omitempty" gorm:"index"` Email string `json:"email,omitempty" gorm:"index"` Phone string `json:"phone,omitempty" gorm:"index"` Gender int `json:"gender,omitempty"` BioID string `json:"bio,omitempty"` Status api.UserStatus `json:"status,omitempty"` Location string `json:"location,omitempty"` Emotion int `json:"emotion,omitempty"` Avatar string `json:"avatar,omitempty"` URL string `json:"url,omitempty"` NumFollowing int `json:"num_following,omitempty"` NumProjects int `json:"num_projects,omitempty"` NumGroup int `json:"num_group,omitempty"` NumTeams int `json:"num_teams,omitempty"` ShortDesc string `json:"short_desc,omitempty"` }
func GetGroupMemberInfoList ¶
func GetUsersByIds ¶
func (*User) GetByEmail ¶
func (*User) GetByPhone ¶
func (*User) UpdateAvatar ¶
func (*User) UpdateName ¶
Click to show internal directories.
Click to hide internal directories.