Documentation ¶
Index ¶
- Variables
- type Author
- type Comments
- type CommentsID
- type CommentsModel
- type CountResult
- type HardStatus
- type Interviews
- type InterviewsModel
- type InterviewsTags
- type InterviewsTagsModel
- type MessageCenter
- type MessageCenterModel
- type MessageConfig
- type MessageConfigModel
- type MongoClient
- type User
- type UserModel
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidObjectId = errors.New("invalid objectId")
View Source
var ErrNotFound = errors.New("not found")
Functions ¶
This section is empty.
Types ¶
type Comments ¶
type Comments struct { ID bson.ObjectId `bson:"_id" json:"id"` ArticleID bson.ObjectId `bson:"article_id" json:"article_id"` Avatar string `bson:"avatar" json:"avatar"` Content string `bson:"content" json:"content"` CreatedTime time.Time `bson:"created_time" json:"created_time"` Good int64 `bson:"good" json:"good"` Name string `bson:"name" json:"name"` Reply []struct { Avatar string `bson:"avatar" json:"avatar"` Content string `bson:"content" json:"content"` CreatedTime time.Time `bson:"created_time" json:"created_time"` Name string `bson:"name" json:"name"` UserID bson.ObjectId `bson:"user_id" json:"user_id"` } `bson:"reply" json:"reply"` UserID bson.ObjectId `bson:"user_id" json:"user_id"` }
type CommentsID ¶
type CommentsModel ¶
type CommentsModel interface { Insert(ctx context.Context, data *Comments) error FindOne(ctx context.Context, id string) (*Comments, error) Update(ctx context.Context, data *Comments) error Delete(ctx context.Context, id string) error }
func NewCommentsModel ¶
func NewCommentsModel(url, collection string) CommentsModel
type CountResult ¶
type HardStatus ¶
type Interviews ¶
type Interviews struct { ID bson.ObjectId `bson:"_id" json:"_id"` Author Author `bson:"author" json:"author"` Content string `bson:"content" json:"content"` Bad int64 `bson:"bad" json:"bad"` ClickNum int64 `bson:"click_num" json:"click_num"` Comments []CommentsID `bson:"comments" json:"comments"` CreatedTime time.Time `bson:"created_time" json:"created_time"` Good int64 `bson:"good" json:"good"` HardStatus string `bson:"hard_status" json:"hard_status"` HotNum int64 `bson:"hot_num" json:"hot_num"` StarNum int64 `bson:"star_num" json:"star_num"` Summary string `bson:"summary" json:"summary"` Tags []string `bson:"tags" json:"tags"` Title string `bson:"title" json:"title"` UpdatedTime time.Time `bson:"updated_time" json:"updated_time"` }
type InterviewsModel ¶
type InterviewsModel interface { Insert(ctx context.Context, data *Interviews) error FindOne(ctx context.Context, id string) (*Interviews, error) CountHardStatus(ctx context.Context, result *[]CountResult) error FindByTagsAndSearchWord(ctx context.Context, oIDs []bson.ObjectId, tags []string, search string, page types.CommonPage) (*[]Interviews, error) Update(ctx context.Context, data *Interviews) error UpdateFields(ctx context.Context, id string, data *map[string]interface{}) error Delete(ctx context.Context, id string) error }
func NewInterviewsModel ¶
func NewInterviewsModel(url, collection string) InterviewsModel
type InterviewsTags ¶
type InterviewsTagsModel ¶
type InterviewsTagsModel interface { Insert(ctx context.Context, data *InterviewsTags) error FindOne(ctx context.Context, id string) (*InterviewsTags, error) CheckTag(ctx context.Context, tags []string) (bool, error) FindAll(ctx context.Context) (*[]InterviewsTags, error) Update(ctx context.Context, data *InterviewsTags) error Delete(ctx context.Context, id string) error }
func NewInterviewsTagsModel ¶
func NewInterviewsTagsModel(url, collection string) InterviewsTagsModel
type MessageCenter ¶
type MessageCenter struct { ID bson.ObjectId `bson:"_id" json:"_id"` Content string `bson:"content" json:"content"` CreatedTime time.Time `bson:"created_time" json:"created_time"` Title string `bson:"title" json:"title"` Type int64 `bson:"type" json:"type"` User struct { ID bson.ObjectId `bson:"_id" json:"_id"` Action string `bson:"action" json:"action"` Avatar string `bson:"avatar" json:"avatar"` Name string `bson:"name" json:"name"` } `bson:"user" json:"user"` }
type MessageCenterModel ¶
type MessageCenterModel interface { Insert(ctx context.Context, data *MessageCenter) error FindOne(ctx context.Context, id string) (*MessageCenter, error) Update(ctx context.Context, data *MessageCenter) error Delete(ctx context.Context, id string) error }
func NewMessageCenterModel ¶
func NewMessageCenterModel(url, collection string) MessageCenterModel
type MessageConfig ¶
type MessageConfig struct { ID bson.ObjectId `bson:"_id" json:"_id"` Comments bool `bson:"comments" json:"comments"` Follow bool `bson:"follow" json:"follow"` GoodAndStar bool `bson:"good_and_star" json:"good_and_star"` MailNotice struct { Comments bool `bson:"comments" json:"comments"` Follow bool `bson:"follow" json:"follow"` GoodAndStar bool `bson:"good_and_star" json:"good_and_star"` } `bson:"mail_notice" json:"mail_notice"` UserID bson.ObjectId `bson:"user_id" json:"user_id"` }
type MessageConfigModel ¶
type MessageConfigModel interface { Insert(ctx context.Context, data *MessageConfig) error FindOne(ctx context.Context, id string) (*MessageConfig, error) FindOneByUserID(ctx context.Context, userID string) (*MessageConfig, error) Update(ctx context.Context, data *MessageConfig) error UpdateByUserID(ctx context.Context, data *MessageConfig) error Delete(ctx context.Context, id string) error }
func NewMessageConfigModel ¶
func NewMessageConfigModel(url, collection string) MessageConfigModel
type MongoClient ¶
type MongoClient struct { CommentsModel InterviewsModel InterviewsTagsModel UserModel MessageCenterModel MessageConfigModel }
type User ¶
type User struct { ID bson.ObjectId `bson:"_id" json:"_id"` OpenId string `bson:"open_id" json:"open_id"` Avatar string `bson:"avatar" json:"avatar"` Birthday time.Time `bson:"birthday" json:"birthday"` Blog string `bson:"blog" json:"blog"` City string `bson:"city" json:"city"` Email string `bson:"email" json:"email"` Followers []struct { ID bson.ObjectId `bson:"_id" json:"_id"` } `bson:"followers" json:"followers"` Following []struct { ID bson.ObjectId `bson:"_id" json:"_id"` } `bson:"following" json:"following"` InterviewsStatus map[string]int64 `bson:"interviews_status" json:"interviews_status"` Name string `bson:"name" json:"name"` Phone int64 `bson:"phone" json:"phone"` RealName string `bson:"real_name" json:"real_name"` Skills []string `bson:"skills" json:"skills"` StarInterviews []struct { ID bson.ObjectId `bson:"_id" json:"_id"` } `bson:"star_interviews" json:"star_interviews"` Summary string `bson:"summary" json:"summary"` }
type UserModel ¶
type UserModel interface { Insert(ctx context.Context, data *User) error FindOne(ctx context.Context, id string) (*User, error) FindBySearch(ctx context.Context, search string, pageNo int, pageSize int) (*[]User, error) FindUsersBySearchAndIds(ctx context.Context, search string, ids []bson.ObjectId, pageNo int, pageSize int) (*[]User, error) Update(ctx context.Context, data *User) error UpdateFields(ctx context.Context, id string, data *map[string]interface{}) error AddUserToSetByID(ctx context.Context, id string, key string, valueID string) error Delete(ctx context.Context, id string) error DeleteUserToSetByID(ctx context.Context, id string, key string, valueID string) error FindOneByOpenId(ctx context.Context, openId string) (*User, error) }
func NewUserModel ¶
Click to show internal directories.
Click to hide internal directories.