Documentation ¶
Index ¶
- Constants
- Variables
- func CalculateAllUserVisitCounts() (int64, error)
- func Close() (err error)
- func CountComments(boardID bbs.BBoardID, articleID bbs.ArticleID) (nComments int, err error)
- func CreateUserEmail(userID bbs.UUserID, email string, updateNanoTS types.NanoTS) (err error)
- func CreateUserIDEmail(userID bbs.UUserID, email string, updateNanoTS types.NanoTS) (err error)
- func DeleteArticles(boardID bbs.BBoardID, articleIDs []bbs.ArticleID, updateNanoTS types.NanoTS) (err error)
- func DeleteCommentsByArticles(boardID bbs.BBoardID, articleIDs []bbs.ArticleID, updateNanoTS types.NanoTS) (err error)
- func DeleteRanks(boardID bbs.BBoardID, articleIDs []bbs.ArticleID, updateNanoTS types.NanoTS) (err error)
- func FavToUserFavorites(f *fav.Fav, userID bbs.UUserID, doubleBufferIdx int, updateNanoTS types.NanoTS, ...) (meta *UserFavoritesMeta, userFavorites []*UserFavorites)
- func Get2FA(userID bbs.UUserID) (emailtoken string, err error)
- func GetBoardID(brdname string) (boardID bbs.BBoardID, err error)
- func GetBoardIDByBid(bid ptttype.Bid) (boardID bbs.BBoardID, err error)
- func GetCommentMapByCommentIDs(boardID bbs.BBoardID, articleID bbs.ArticleID, commentIDs []types.CommentID) (commentMap map[types.CommentID]*Comment, err error)
- func GetCommentSortTimeMapByCommentIDs(boardID bbs.BBoardID, articleID bbs.ArticleID, commentIDs []types.CommentID) (sortTimeMap map[types.CommentID]types.NanoTS, err error)
- func GetUserNickname(userID bbs.UUserID) (nickname string, err error)
- func GetUserVisitCount() (total int64)
- func Init() (err error)
- func InitConfig() error
- func RecoverCommentIDs(commentQueries []*CommentQuery) (err error)
- func RemoveCommentIDs(bboardID bbs.BBoardID, articleID bbs.ArticleID, ...) (err error)
- func RemoveManArticleSummaries(boardID bbs.BBoardID, levelIdx types.ManArticleID, idx int) (err error)
- func ResetArticleIsBottom(boardID bbs.BBoardID) (err error)
- func Set2FA(userID bbs.UUserID, email string, token string, expireTSDuration time.Duration) (err error)
- func SetIsTest()
- func SetUserVisitCount(count int64) error
- func SumRank(boardID bbs.BBoardID, articleID bbs.ArticleID) (total int, err error)
- func TryLock(key string, expireTSDuration time.Duration) (err error)
- func TwoFactorSerializeValue(email string, token string) string
- func Unlock(key string) (err error)
- func UnsetIsTest()
- func UpdateAccessToken(accessToken *AccessToken) (err error)
- func UpdateArticleComments(articleComments *ArticleComments) (err error)
- func UpdateArticleCommentsByArticleID(boardID bbs.BBoardID, articleID bbs.ArticleID, updateNanoTS types.NanoTS) (err error)
- func UpdateArticleContentInfo(boardID bbs.BBoardID, articleID bbs.ArticleID, contentInfo *ArticleContentInfo) (err error)
- func UpdateArticleContentMTime(bboardID bbs.BBoardID, articleID bbs.ArticleID, contentMTime types.NanoTS) (err error)
- func UpdateArticleEditSummary(boardID bbs.BBoardID, articleID bbs.ArticleID, ...) (err error)
- func UpdateArticleFirstComments(articleFirstComments *ArticleFirstComments) (err error)
- func UpdateArticleRank(boardID bbs.BBoardID, articleID bbs.ArticleID, diffRank int, ...) (newRank int, err error)
- func UpdateArticleSummaries(articleSummaries []*ArticleSummary, updateNanoTS types.NanoTS) (err error)
- func UpdateArticleSummaryWithRegexes(articleSummaryWithRegexes []*ArticleSummaryWithRegex, ...) (err error)
- func UpdateBoardDetails(boardDetails []*BoardDetail, updateNanoTS types.NanoTS) (err error)
- func UpdateBoardSummaries(boardSummaries []*BoardSummary, updateNanoTS types.NanoTS) (err error)
- func UpdateClient(c *Client) (err error)
- func UpdateCommentSummaries(bboardID bbs.BBoardID, articleID bbs.ArticleID, ...) (err error)
- func UpdateComments(comments []*Comment, updateNanoTS types.NanoTS) (err error)
- func UpdateContentBlocks(contentBlocks []*ContentBlock, updateNanoTS types.NanoTS) (err error)
- func UpdateManArticleContentInfo(bboardID bbs.BBoardID, articleID types.ManArticleID, ...) (err error)
- func UpdateManArticleContentMTime(bboardID bbs.BBoardID, articleID types.ManArticleID, contentMTime types.NanoTS) (err error)
- func UpdateManArticleSummaries(articleSummaries []*ManArticleSummary, updateNanoTS types.NanoTS) (err error)
- func UpdateManContentBlocks(contentBlocks []*ContentBlock, updateNanoTS types.NanoTS) (err error)
- func UpdateRank(boardID bbs.BBoardID, articleID bbs.ArticleID, ownerID bbs.UUserID, rank int, ...) (origRank int, err error)
- func UpdateUserDetail(user *UserDetail) (err error)
- func UpdateUserEmailIsSet(userID bbs.UUserID, email string, isSet bool, updateNanoTS types.NanoTS) (err error)
- func UpdateUserFavorites(userID bbs.UUserID, doubleBufferIdx int, userFavorites []*UserFavorites, ...) (err error)
- func UpdateUserFavoritesMeta(meta *UserFavoritesMeta) (err error)
- func UpdateUserIDEmailIsSet(userID bbs.UUserID, email string, isSet bool, updateNanoTS types.NanoTS) (err error)
- func UpdateUserPosttime(userID bbs.UUserID, postTime int) (err error)
- func UpdateUserReadArticle(userReadArticle *UserReadArticle) (err error)
- func UpdateUserReadArticles(userReadArticles []*UserReadArticle, updateNanoTS types.NanoTS) (err error)
- func UpdateUserReadBoard(userReadBoard *UserReadBoard) (err error)
- func UpdateUserReadBoards(userReadBoards []*UserReadBoard, updateNanoTS types.NanoTS) (err error)
- func UpdateUserVisit(userVisit *UserVisit) (err error)
- func UserFavoritesToFav(meta *FolderMeta, userFavorites []*UserFavorites, depth int) (f *fav.Fav, err error)
- type AccessToken
- type Article
- type ArticleComments
- type ArticleContentInfo
- type ArticleContentMTime
- type ArticleCreateQuery
- type ArticleDetailSummary
- type ArticleEditSummary
- type ArticleFirstComments
- type ArticleIsDeleted
- type ArticleNComments
- type ArticlePermInfo
- type ArticleQuery
- type ArticleRank
- type ArticleSummary
- func GetArticleSummaries(boardID bbs.BBoardID, startIdx string, descending bool, limit int) (result []*ArticleSummary, err error)
- func GetArticleSummariesByBoardArticleIDs(boardArticleIDs []types.BoardArticleID) (result []*ArticleSummary, err error)
- func GetArticleSummariesByOwnerID(ownerID bbs.UUserID, startCreateTime types.NanoTS, descending bool, limit int) (result []*ArticleSummary, err error)
- func GetArticleSummariesByRegex(boardID bbs.BBoardID, keywordList []string, createNanoTS types.NanoTS, ...) (result []*ArticleSummary, err error)
- func GetArticleSummary(bboardID bbs.BBoardID, articleID bbs.ArticleID) (result *ArticleSummary, err error)
- func GetBottomArticleSummaries(boardID bbs.BBoardID) (result []*ArticleSummary, err error)
- func NewArticleSummary(a_b *bbs.ArticleSummary, updateNanoTS types.NanoTS) *ArticleSummary
- type ArticleSummaryWithRegex
- func GetArticleSummaryWithRegex(bboardID bbs.BBoardID, articleID bbs.ArticleID) (result *ArticleSummaryWithRegex, err error)
- func NewArticleSummaryWithRegex(a_b *bbs.ArticleSummary, updateNanoTS types.NanoTS) *ArticleSummaryWithRegex
- func NewArticleSummaryWithRegexFromPBArticle(boardID bbs.BBoardID, a_b *boardd.Post, updateNanoTS types.NanoTS, ...) *ArticleSummaryWithRegex
- type Board
- type BoardBanUser
- type BoardBid
- type BoardDetail
- type BoardFriend
- type BoardID
- type BoardPermInfo
- type BoardQuery
- type BoardSummary
- func GetBoardSummariesByClsID(clsID ptttype.Bid, startIdx string, isAsc bool, limit int, ...) (boardSummaries []*BoardSummary, err error)
- func GetBoardSummary(bboardID bbs.BBoardID) (result *BoardSummary, err error)
- func NewBoardSummary(b_b *bbs.BoardSummary, updateNanoTS types.NanoTS) *BoardSummary
- func NewBoardSummaryFromPBBoard(b_b *boardd.Board, updateNanoTS types.NanoTS) *BoardSummary
- type Client
- type Comment
- type CommentArticleQuery
- type CommentDBCS
- type CommentIsDeleted
- type CommentMD5
- type CommentQuery
- type CommentSortTime
- type CommentSummary
- func GetBasicCommentSummariesByOwnerID(ownerID bbs.UUserID, startSortTime types.NanoTS, descending bool, limit int) (result []*CommentSummary, err error)
- func GetCommentSummaries(bboardID bbs.BBoardID, articleID bbs.ArticleID, startNanoTS types.NanoTS, ...) (commentSummaries []*CommentSummary, err error)
- type ContentBlock
- func GetAllContentBlocks(boardID bbs.BBoardID, articleID bbs.ArticleID, contentID types.ContentID) (contentBlocks []*ContentBlock, err error)
- func GetAllManContentBlocks(boardID bbs.BBoardID, articleID types.ManArticleID, contentID types.ContentID) (contentBlocks []*ContentBlock, err error)
- func GetContentBlock(boardID bbs.BBoardID, articleID bbs.ArticleID, contentID types.ContentID, ...) (contentBlock *ContentBlock, err error)
- func GetContentBlocks(boardID bbs.BBoardID, articleID bbs.ArticleID, contentID types.ContentID, ...) (contentBlocks []*ContentBlock, err error)
- func GetManContentBlock(boardID bbs.BBoardID, articleID types.ManArticleID, contentID types.ContentID, ...) (contentBlock *ContentBlock, err error)
- func GetManContentBlocks(boardID bbs.BBoardID, articleID types.ManArticleID, contentID types.ContentID, ...) (contentBlocks []*ContentBlock, err error)
- type ContentBlockQuery
- type FolderMeta
- type LevelIdx
- type ManArticle
- type ManArticleContentInfo
- type ManArticleContentMTime
- type ManArticleDetailSummary
- type ManArticleQuery
- type ManArticleSummary
- type Rank
- type RankAgged
- type RankIsDeleted
- type User
- type UserAloha
- type UserArticle
- type UserBoard
- type UserDetail
- type UserEmail
- type UserFavoriteID
- type UserFavorites
- func GetAllUserFavorites(userID bbs.UUserID, doubleBufferIdx int, mTime types.NanoTS) (userFavorites []*UserFavorites, err error)
- func GetUserFavorites(userID bbs.UUserID, doubleBufferIdx int, levelIdx LevelIdx, startIdx int, ...) (userFavorites []*UserFavorites, err error)
- func SortUserFavoritesByFavIdx(userFavorites []*UserFavorites, ascending bool) (newUserFavorites []*UserFavorites)
- type UserFavoritesMeta
- type UserFavoritesMetaSummary
- type UserFavoritesNanoTS
- type UserFavoritesQuery
- type UserFriend
- type UserIDEmail
- type UserInfoSummary
- type UserNewInfo
- type UserNickname
- type UserPermInfo
- type UserPosttime
- type UserQuery
- type UserReadArticle
- type UserReadArticleQuery
- type UserReadBoard
- type UserReadBoardQuery
- type UserReject
- type UserVisit
Constants ¶
const ( TITLE_REGEX_N_GRAM = 5 TIME_CALC_ALL_USER_VISIT_COUNTS = -10 * time.Minute MAX_CONTENT_BLOCK = 5 MAX_ALL_CONTENT_BLOCK = 2000 STR_REPLY = "Re:" STR_REPLY_LOWER = "re:" STR_FORWARD = "Fw:" STR_FORWARD_LOWER = "fw:" STR_LEGACY_FORWARD = "[轉錄]" MAX_COMMENT_BYTES = 90 )
const (
N_USER_FAVORITES_DOUBLE_BUFFER = 2
)
Variables ¶
var ( MONGO_HOST = "localhost" MONGO_PORT = 27017 MONGO_DBNAME = "devptt" MONGO_PROTOCOL = "mongodb" MAX_COMMENT_BLOCK = 20 MAX_COMMENT_SUMMARY_BLOCK = 50 REDIS_HOST = "localhost:6379" REDIS_TIMEOUT_MILLI_TS = time.Duration(10) )
var ( ACCESS_TOKEN_ACCESS_TOKEN_b = getBSONName(EMPTY_ACCESS_TOKEN, "AccessToken") ACCESS_TOKEN_USER_ID_b = getBSONName(EMPTY_ACCESS_TOKEN, "UserID") ACCESS_TOKEN_UPDATE_NANO_TS_b = getBSONName(EMPTY_ACCESS_TOKEN, "UpdateNanoTS") )
var ( ARTICLE_BBOARD_ID_b = getBSONName(EMPTY_ARTICLE, "BBoardID") ARTICLE_ARTICLE_ID_b = getBSONName(EMPTY_ARTICLE, "ArticleID") ARTICLE_BOARD_ARTICLE_ID_b = getBSONName(EMPTY_ARTICLE, "BoardArticleID") ARTICLE_IS_DELETED_b = getBSONName(EMPTY_ARTICLE, "IsDeleted") ARTICLE_FILENAME_b = getBSONName(EMPTY_ARTICLE, "Filename") ARTICLE_CREATE_TIME_b = getBSONName(EMPTY_ARTICLE, "CreateTime") ARTICLE_MTIME_b = getBSONName(EMPTY_ARTICLE, "MTime") ARTICLE_RECOMMEND_b = getBSONName(EMPTY_ARTICLE, "Recommend") ARTICLE_OWNER_b = getBSONName(EMPTY_ARTICLE, "Owner") ARTICLE_FULL_TITLE_b = getBSONName(EMPTY_ARTICLE, "FullTitle") ARTICLE_TITLE_b = getBSONName(EMPTY_ARTICLE, "Title") ARTICLE_MONEY_b = getBSONName(EMPTY_ARTICLE, "Money") ARTICLE_CLASS_b = getBSONName(EMPTY_ARTICLE, "Class") ARTICLE_FILEMODE_b = getBSONName(EMPTY_ARTICLE, "Filemode") ARTICLE_TITLE_REGEX_b = getBSONName(EMPTY_ARTICLE, "TitleRegex") ARTICLE_IDX_b = getBSONName(EMPTY_ARTICLE, "Idx") ARTICLE_UPDATE_NANO_TS_b = getBSONName(EMPTY_ARTICLE, "UpdateNanoTS") ARTICLE_CONTENT_MTIME_b = getBSONName(EMPTY_ARTICLE, "ContentMTime") ARTICLE_CONTENT_MD5_B = getBSONName(EMPTY_ARTICLE, "ContentMD5") ARTICLE_CONTENT_b = getBSONName(EMPTY_ARTICLE, "Content") ARTICLE_CONTENT_PREFIX_b = getBSONName(EMPTY_ARTICLE, "ContentPrefix") ARTICLE_IP_b = getBSONName(EMPTY_ARTICLE, "IP") ARTICLE_HOST_b = getBSONName(EMPTY_ARTICLE, "Host") ARTICLE_BBS_b = getBSONName(EMPTY_ARTICLE, "BBS") ARTICLE_CONTENT_UPDATE_NANO_TS_b = getBSONName(EMPTY_ARTICLE, "ContentUpdateNanoTS") ARTICLE_SIGNATURE_DBCS_b = getBSONName(EMPTY_ARTICLE, "SignatureDBCS") ARTICLE_SIGNATURE_MD5_b = getBSONName(EMPTY_ARTICLE, "SignatureMD5") ARTICLE_FIRST_COMMENTS_MD5_b = getBSONName(EMPTY_ARTICLE, "FirstCommentsMD5") ARTICLE_FIRST_COMMENTS_LAST_TIME_b = getBSONName(EMPTY_ARTICLE, "FirstCommentsLastTime") ARTICLE_FIRST_COMMENTS_UPDATE_NANO_TS_b = getBSONName(EMPTY_ARTICLE, "FirstCommentsUpdateNanoTS") ARTICLE_N_COMMENTS_b = getBSONName(EMPTY_ARTICLE, "NComments") ARTICLE_COMMENTS_UPDATE_NANO_TS_b = getBSONName(EMPTY_ARTICLE, "CommentsUpdateNanoTS") ARTICLE_RANK_b = getBSONName(EMPTY_ARTICLE, "Rank") ARTICLE_RANK_TO_UPDATE_NANO_TS_b = getBSONName(EMPTY_ARTICLE, "RankToUpdateNanoTS") ARTICLE_RANK_UPDATE_NANO_TS_b = getBSONName(EMPTY_ARTICLE, "RankUpdateNanoTS") ARTICLE_SUBJECT_TYPE_b = getBSONName(EMPTY_ARTICLE, "SubjectType") ARTICLE_IS_BOTTOM_b = getBSONName(EMPTY_ARTICLE, "IsBottom") )
var ( BOARD_BBOARD_ID_b = getBSONName(EMPTY_BOARD, "BBoardID") BOARD_BRDNAME_b = getBSONName(EMPTY_BOARD, "Brdname") BOARD_TITLE_b = getBSONName(EMPTY_BOARD, "Title") BOARD_BRD_ATTR_b = getBSONName(EMPTY_BOARD, "BrdAttr") BOARD_BOARD_TYPE_b = getBSONName(EMPTY_BOARD, "BoardType") BOARD_CATEGORY_b = getBSONName(EMPTY_BOARD, "Category") BOARD_NUSER_b = getBSONName(EMPTY_BOARD, "NUser") BOARD_BMS_b = getBSONName(EMPTY_BOARD, "BMs") BOARD_TOTAL_b = getBSONName(EMPTY_BOARD, "Total") BOARD_LAST_POST_TIME_b = getBSONName(EMPTY_BOARD, "LastPostTime") BOARD_UDPATE_TIME_b = getBSONName(EMPTY_BOARD, "UpdateTime") BOARD_VOTE_LIMIT_LOGINS_b = getBSONName(EMPTY_BOARD, "VoteLimitLogins") BOARD_POST_LIMIT_LOGINS_b = getBSONName(EMPTY_BOARD, "PostLimitLogins") BOARD_VOTE_LIMIT_BADPOST_b = getBSONName(EMPTY_BOARD, "VoteLimitBadpost") BOARD_POST_LIMIT_BADPOST_b = getBSONName(EMPTY_BOARD, "PostLimitBadpost") BOARD_PARENT_b = getBSONName(EMPTY_BOARD, "Parent") BOARD_NVOTE_b = getBSONName(EMPTY_BOARD, "NVote") BOARD_VOTE_CLOSING_TIME_b = getBSONName(EMPTY_BOARD, "VoteClosingTime") BOARD_LEVEL_b = getBSONName(EMPTY_BOARD, "Level") BOARD_LAST_SET_TIME_b = getBSONName(EMPTY_BOARD, "LastSetTime") BOARD_POST_EXPIRE_b = getBSONName(EMPTY_BOARD, "PostExpire") BOARD_END_GAMBLE_NANO_TS_b = getBSONName(EMPTY_BOARD, "EndGambleNanoTS") BOARD_POST_TYPE_b = getBSONName(EMPTY_BOARD, "PostType") BOARD_POST_TEMPLATE_b = getBSONName(EMPTY_BOARD, "PostTemplate") BOARD_FAST_RECOMMEND_PAUSE_b = getBSONName(EMPTY_BOARD, "FastRecommendPause") BOARD_IS_DELETED_b = getBSONName(EMPTY_BOARD, "IsDeleted") BOARD_UPDATE_NANO_TS_b = getBSONName(EMPTY_BOARD, "UpdateNanoTS") BOARD_GID_b = getBSONName(EMPTY_BOARD, "Gid") BOARD_BID_b = getBSONName(EMPTY_BOARD, "Bid") BOARD_IDX_BY_NAME_b = getBSONName(EMPTY_BOARD, "IdxByName") BOARD_IDX_BY_CLASS_b = getBSONName(EMPTY_BOARD, "IdxByClass") BOARD_CHESS_COUNTRY_b = getBSONName(EMPTY_BOARD, "ChessCountry") )
var ( CLIENT_CLIENT_ID_b = getBSONName(EMPTY_CLIENT, "ClientID") CLIENT_CLIENT_SECRET_b = getBSONName(EMPTY_CLIENT, "ClientSecret") CLIENT_REMOTE_ADDR_b = getBSONName(EMPTY_CLIENT, "RemoteAddr") CLIENT_UPDATE_NANO_TS_b = getBSONName(EMPTY_CLIENT, "UpdateNanoTS") )
var ( COMMENT_BBOARD_ID_b = getBSONName(EMPTY_COMMENT, "BBoardID") COMMENT_ARTICLE_ID_b = getBSONName(EMPTY_COMMENT, "ArticleID") COMMENT_COMMENT_ID_b = getBSONName(EMPTY_COMMENT, "CommentID") COMMENT_THE_TYPE_b = getBSONName(EMPTY_COMMENT, "TheType") COMMENT_REF_IDS_b = getBSONName(EMPTY_COMMENT, "RefIDs") COMMENT_IS_DELETED_b = getBSONName(EMPTY_COMMENT, "IsDeleted") COMMENT_DELETE_REASON_b = getBSONName(EMPTY_COMMENT, "DeleteReason") COMMENT_CREATE_TIME_b = getBSONName(EMPTY_COMMENT, "CreateTime") COMMENT_OWNER_b = getBSONName(EMPTY_COMMENT, "Owner") COMMENT_CONTENT_b = getBSONName(EMPTY_COMMENT, "Content") COMMENT_IP_b = getBSONName(EMPTY_COMMENT, "IP") COMMENT_HOST_b = getBSONName(EMPTY_COMMENT, "Host") COMMENT_MD5_b = getBSONName(EMPTY_COMMENT, "MD5") COMMENT_FIRST_CREATE_TIME_b = getBSONName(EMPTY_COMMENT, "FirstCreateTime") COMMENT_INFERRED_CREATE_TIME_b = getBSONName(EMPTY_COMMENT, "InferredCreateTime") COMMENT_NEW_CREATE_TIME_b = getBSONName(EMPTY_COMMENT, "NewCreateTime") COMMENT_SORT_TIME_b = getBSONName(EMPTY_COMMENT, "SortTime") COMMENT_THE_DATE_b = getBSONName(EMPTY_COMMENT, "TheDate") COMMENT_DBCS_b = getBSONName(EMPTY_COMMENT, "DBCS") COMMENT_EDIT_NANO_TS_b = getBSONName(EMPTY_COMMENT, "EditNanoTS") COMMENT_UPDATE_NANO_TS_b = getBSONName(EMPTY_COMMENT, "UpdateNanoTS") )
var ( CONTENT_BLOCK_BBOARD_ID_b = getBSONName(EMPTY_CONTENT_BLOCK, "BBoardID") CONTENT_BLOCK_ARTICLE_ID_b = getBSONName(EMPTY_CONTENT_BLOCK, "ArticleID") CONTENT_BLOCK_CONTENT_ID_b = getBSONName(EMPTY_CONTENT_BLOCK, "ContentID") CONTENT_BLOCK_IDX_b = getBSONName(EMPTY_CONTENT_BLOCK, "Idx") CONTENT_BLOCK_IS_DELETED_b = getBSONName(EMPTY_CONTENT_BLOCK, "IsDeleted") CONTENT_BLOCK_CONTENT_b = getBSONName(EMPTY_CONTENT_BLOCK, "Content") CONTENT_BLOCK_UPDATE_NANO_TS_b = getBSONName(EMPTY_CONTENT_BLOCK, "UpdateNanoTS") )
var ( ErrNoLock = errors.New("no lock") ErrNoMatch = errors.New("no match") ErrNoUpdate = errors.New("no update") ErrNoCreate = errors.New("no create") ErrInvalidUserFavorites = errors.New("invalid user favorites") Err2FAAlreadyExists = errors.New("2fa already exists") ErrNotFound = errors.New("not found") )
var ( MAN_ARTICLE_BBOARD_ID_b = getBSONName(EMPTY_MAN_ARTICLE, "BBoardID") MAN_ARTICLE_ARTICLE_ID_b = getBSONName(EMPTY_MAN_ARTICLE, "ArticleID") MAN_ARTICLE_LEVEL_IDX_b = getBSONName(EMPTY_MAN_ARTICLE, "LevelIdx") MAN_ARTICLE_IS_DELETED_b = getBSONName(EMPTY_MAN_ARTICLE, "IsDeleted") MAN_ARTICLE_CREATE_TIME_b = getBSONName(EMPTY_MAN_ARTICLE, "CreateTime") MAN_ARTICLE_TITLE_b = getBSONName(EMPTY_MAN_ARTICLE, "Title") MAN_ARTICLE_FILEMODE_b = getBSONName(EMPTY_MAN_ARTICLE, "Filemode") MAN_ARTICLE_IS_DIR_b = getBSONName(EMPTY_MAN_ARTICLE, "IsDir") MAN_ARTICLE_UPDATE_NANO_TS_b = getBSONName(EMPTY_MAN_ARTICLE, "UpdateNanoTS") MAN_ARTICLE_CONTENT_MTIME_b = getBSONName(EMPTY_MAN_ARTICLE, "ContentMTime") MAN_ARTICLE_CONTENT_MD5_b = getBSONName(EMPTY_MAN_ARTICLE, "ContentMD5") MAN_ARTICLE_CONTENT_b = getBSONName(EMPTY_MAN_ARTICLE, "Content") MAN_ARTICLE_CONTENT_ID_b = getBSONName(EMPTY_MAN_ARTICLE, "ContentID") MAN_ARTICLE_IP_b = getBSONName(EMPTY_MAN_ARTICLE, "IP") MAN_ARTICLE_HOST_b = getBSONName(EMPTY_MAN_ARTICLE, "Host") MAN_ARTICLE_BBS_b = getBSONName(EMPTY_MAN_ARTICLE, "BBS") MAN_ARTICLE_CONTENT_UPDATE_NANO_TS_b = getBSONName(EMPTY_MAN_ARTICLE, "ContentUpdateNanoTS") MAN_ARTICLE_IDX_b = getBSONName(EMPTY_MAN_ARTICLE, "Idx") )
var ( RANK_BBOARD_ID_b = getBSONName(EMPTY_RANK, "BBoardID") RANK_ARTICLE_ID_b = getBSONName(EMPTY_RANK, "ArticleID") RANK_OWNER_b = getBSONName(EMPTY_RANK, "Owner") RANK_RANK_b = getBSONName(EMPTY_RANK, "Rank") RANK_UPDATE_NANO_TS_b = getBSONName(EMPTY_RANK, "UpdateNanoTS") )
var ( USER_USER_ID_b = getBSONName(EMPTY_USER, "UserID") USER_USERNAME_b = getBSONName(EMPTY_USER, "Username") USER_REALNAME_b = getBSONName(EMPTY_USER, "Realname") USER_NICKNAME_b = getBSONName(EMPTY_USER, "Nickname") USER_UFLAG_b = getBSONName(EMPTY_USER, "Uflag") USER_USER_LEVEL_b = getBSONName(EMPTY_USER, "Userlevel") USER_NUMLOGINDAYS_b = getBSONName(EMPTY_USER, "Numlogindays") USER_NUMPOSTS_b = getBSONName(EMPTY_USER, "Numposts") USER_FIRSTLOGIN_b = getBSONName(EMPTY_USER, "Firstlogin") USER_LASTLOGIN_b = getBSONName(EMPTY_USER, "Lastlogin") USER_LAST_IP_b = getBSONName(EMPTY_USER, "LastIP") USER_LAST_HOST_b = getBSONName(EMPTY_USER, "LastHost") USER_MONEY_b = getBSONName(EMPTY_USER, "Money") USER_PTTEMAIL_b = getBSONName(EMPTY_USER, "PttEmail") USER_JUSTIFY_b = getBSONName(EMPTY_USER, "Justify") USER_OVER18_b = getBSONName(EMPTY_USER, "Over18") USER_PAGER_UI_TYPE_b = getBSONName(EMPTY_USER, "PagerUIType") USER_PAGER_b = getBSONName(EMPTY_USER, "Pager") USER_INVISIBLE_b = getBSONName(EMPTY_USER, "Invisible") USER_EXMAILBOX_b = getBSONName(EMPTY_USER, "Exmailbox") USER_CAREER_b = getBSONName(EMPTY_USER, "Career") USER_ROLE_b = getBSONName(EMPTY_USER, "Role") USER_LAST_SEEN_b = getBSONName(EMPTY_USER, "LastSeen") USER_TIME_SET_ANGEL_b = getBSONName(EMPTY_USER, "TimeSetAngel") USER_TIME_PLAY_ANGEL_b = getBSONName(EMPTY_USER, "TimePlayAngel") USER_LAST_SONG_b = getBSONName(EMPTY_USER, "LastSong") USER_LOGIN_VIEW_b = getBSONName(EMPTY_USER, "LoginView") USER_VLCOUNT_b = getBSONName(EMPTY_USER, "Vlcount") USER_FIVE_WIN_b = getBSONName(EMPTY_USER, "FiveWin") USER_FIVE_LOSE_b = getBSONName(EMPTY_USER, "FiveLose") USER_FIVE_TIE_b = getBSONName(EMPTY_USER, "FiveTie") USER_CHC_WIN_b = getBSONName(EMPTY_USER, "ChcWin") USER_CHC_LOSE_b = getBSONName(EMPTY_USER, "ChcLose") USER_CHC_TIE_b = getBSONName(EMPTY_USER, "ChcTie") USER_CONN6_WIN_b = getBSONName(EMPTY_USER, "Conn6Win") USER_CONN6_LOSE_b = getBSONName(EMPTY_USER, "Conn6Lose") USER_CONN6_TIE_b = getBSONName(EMPTY_USER, "Conn6Tie") USER_GO_WIN_b = getBSONName(EMPTY_USER, "GoWin") USER_GO_LOSE_b = getBSONName(EMPTY_USER, "GoLose") USER_GO_TIE_b = getBSONName(EMPTY_USER, "GoTie") USER_DARK_WIN_b = getBSONName(EMPTY_USER, "DarkWin") USER_DARK_LOSE_b = getBSONName(EMPTY_USER, "DarkLose") USER_DARK_TIE_b = getBSONName(EMPTY_USER, "DarkTie") USER_UA_VERSION_b = getBSONName(EMPTY_USER, "UaVersion") USER_SIGNATURE_b = getBSONName(EMPTY_USER, "Signature") USER_BAD_POST_b = getBSONName(EMPTY_USER, "BadPost") USER_MY_ANGEL_b = getBSONName(EMPTY_USER, "MyAngel") USER_CHESS_ELO_RATING_b = getBSONName(EMPTY_USER, "ChessEloRating") USER_TIME_REMOVE_BAD_POST_b = getBSONName(EMPTY_USER, "TimeRemoveBadPost") USER_TIME_VIOLATE_LAW_b = getBSONName(EMPTY_USER, "TimeViolateLaw") USER_IS_DELETED_b = getBSONName(EMPTY_USER, "IsDeleted") USER_UPDATE_NANO_TS_b = getBSONName(EMPTY_USER, "UpdateNanoTS") USER_USER_LEVEL2_b = getBSONName(EMPTY_USER, "UserLevel2") USER_UPDATE_NANO_TS2_b = getBSONName(EMPTY_USER, "UpdateNanoTS2") USER_AVATAR_b = getBSONName(EMPTY_USER, "Avatar") USER_AVATAR_NANO_TS_b = getBSONName(EMPTY_USER, "AvatorNanoTS") USER_EMAIL_b = getBSONName(EMPTY_USER, "Email") USER_EMAIL_NANO_TS_b = getBSONName(EMPTY_USER, "EmailNanoTS") USER_TWO_FACTOR_ENABLED_b = getBSONName(EMPTY_USER, "TwoFactorEnabled") USER_TWO_FACTOR_ENABLED_NANO_TS_b = getBSONName(EMPTY_USER, "TwoFactorEnabledNanoTS") USER_COOLDOWN_NANO_TS_b = getBSONName(EMPTY_USER, "CooldownNanoTS") USER_COOLDOWN_UPDATE_NANO_TS_b = getBSONName(EMPTY_USER, "CooldownUpdateNanoTS") USER_POSTTIME_b = getBSONName(EMPTY_USER, "Posttime") USER_POSTTIME_UPDATE_NANO_TS_b = getBSONName(EMPTY_USER, "PosttimeUpdateNanoTS") )
var ( USER_ARTICLE_USER_ID_b = getBSONName(EMPTY_USER_ARTICLE, "UserID") USER_ARTICLE_BOARD_ID_b = getBSONName(EMPTY_USER_ARTICLE, "BoardID") USER_ARTICLE_ARTICLE_ID_b = getBSONName(EMPTY_USER_ARTICLE, "ArticleID") USER_ARTICLE_BOARD_ARTICLE_ID_b = getBSONName(EMPTY_USER_ARTICLE, "BoardArticleID") USER_ARTICLE_READ_UPDATE_NANO_TS_b = getBSONName(EMPTY_USER_ARTICLE, "ReadUpdateNanoTS") USER_ARTICLE_ARTICLE_BLOCKED_b = getBSONName(EMPTY_USER_ARTICLE, "ArticleBlocked") USER_ARTICLE_ARTICLE_BLOCKED_REASON_b = getBSONName(EMPTY_USER_ARTICLE, "ArticleBlockedReason") USER_ARTICLE_ARTICLE_BLOCKED_UPDATE_NANO_TS_b = getBSONName(EMPTY_USER_ARTICLE, "ArticleBlockedUpdateNanoTS") USER_ARTICLE_ARTICLE_REPORTED_b = getBSONName(EMPTY_USER_ARTICLE, "ArticleReported") USER_ARTICLE_ARTICLE_REPORTED_REASON_b = getBSONName(EMPTY_USER_ARTICLE, "ArticleReportedReason") USER_ARTICLE_ARTICLE_REPORTED_UPDATE_NANO_TS_b = getBSONName(EMPTY_USER_ARTICLE, "ArticleReportedUpdateNanoTS") )
var ( USER_BOARD_USER_ID_b = getBSONName(EMPTY_USER_BOARD, "UserID") USER_BOARD_BBOARD_ID_b = getBSONName(EMPTY_USER_BOARD, "BBoardID") USER_BOARD_READ_UPDATE_NANO_TS_b = getBSONName(EMPTY_USER_BOARD, "ReadUpdateNanoTS") USER_BOARD_BOARD_FRIEND_b = getBSONName(EMPTY_USER_BOARD, "BoardFriend") USER_BOARD_BOARD_FRIEND_UPDATE_NANO_TS_b = getBSONName(EMPTY_USER_BOARD, "BoardFriendUpdateNanoTS") USER_BOARD_BOARD_BUCKET_b = getBSONName(EMPTY_USER_BOARD, "BoardBucket") USER_BOARD_BOARD_BUCKET_REASON_b = getBSONName(EMPTY_USER_BOARD, "BoardBucketReason") USER_BOARD_BOARD_BUCKET_UPDATE_NANO_TS_b = getBSONName(EMPTY_USER_BOARD, "BoardBucketUpdateNanoTS") USER_BOARD_BOARD_BLOCKED_b = getBSONName(EMPTY_USER_BOARD, "BoardBlocked") USER_BOARD_BOARD_BLOCKED_REASON_b = getBSONName(EMPTY_USER_BOARD, "BoardBlockedReason") USER_BOARD_BOARD_BLOCKED_UPDATE_NANO_TS_b = getBSONName(EMPTY_USER_BOARD, "BoardBlockedUpdateNanoTS") USER_BOARD_BOARD_REPORTED_b = getBSONName(EMPTY_USER_BOARD, "BoardReported") USER_BOARD_BOARD_REPORTED_REASON_b = getBSONName(EMPTY_USER_BOARD, "BoardReportedReason") USER_BOARD_BOARD_REPORTED_UPDATE_NANO_TS_b = getBSONName(EMPTY_USER_BOARD, "BoardReportedUpdateNanoTS") )
var ( USER_EMAIL_USER_ID_b = getBSONName(EMPTY_USER_EMAIL, "UserID") USER_EMAIL_EMAIL_b = getBSONName(EMPTY_USER_EMAIL, "Email") USER_EMAIL_IS_SET_b = getBSONName(EMPTY_USER_EMAIL, "IsSet") USER_EMAIL_UPDATE_NANO_TS_b = getBSONName(EMPTY_USER_EMAIL, "UpdateNanoTS") )
var ( USER_FAVORITES_USER_ID_b = getBSONName(EMPTY_USER_FAVORITES, "UserID") USER_FAVORITES_DOUBLE_BUFFER_IDX_b = getBSONName(EMPTY_USER_FAVORITES, "DoubleBufferIdx") USER_FAVORITES_FAV_IDX_b = getBSONName(EMPTY_USER_FAVORITES, "FavIdx") USER_FAVORITES_LEVEL_IDX_b = getBSONName(EMPTY_USER_FAVORITES, "LevelIdx") USER_FAVORITES_IDX_b = getBSONName(EMPTY_USER_FAVORITES, "Idx") USER_FAVORITES_UPDATE_NANO_TS_b = getBSONName(EMPTY_USER_FAVORITES, "UpdateNanoTS") USER_FAVORITES_MTIME_b = getBSONName(EMPTY_USER_FAVORITES, "MTime") USER_FAVORITES_THE_TYPE_b = getBSONName(EMPTY_USER_FAVORITES, "TheType") USER_FAVORITES_ATTR_b = getBSONName(EMPTY_USER_FAVORITES, "Attr") USER_FAVORITES_THE_ID_b = getBSONName(EMPTY_USER_FAVORITES, "TheID") USER_FAVORITES_FOLDER_TITLE_b = getBSONName(EMPTY_USER_FAVORITES, "FolderTitle") )
var ( USER_FAVORITES_META_USER_ID_b = getBSONName(EMPTY_USER_FAVORITES_META, "UserID") USER_FAVORITES_META_DOUBLE_BUFFER_IDX_b = getBSONName(EMPTY_USER_FAVORITES_META, "DoubleBufferIdx") USER_FAVORITES_META_UPDATE_NANO_TS_b = getBSONName(EMPTY_USER_FAVORITES_META, "UpdateNanoTS") USER_FAVORITES_META_MTIME_b = getBSONName(EMPTY_USER_FAVORITES_META, "MTime") USER_FAVORITES_META_FAV_NUM_b = getBSONName(EMPTY_USER_FAVORITES_META, "FavNum") )
var ( USER_FAVORITES_NANO_TS_USER_ID_b = getBSONName(EMPTY_USER_FAVORITES_NANO_TS, "UserID") USER_FAVORITES_NANO_TS_UPDATE_NANO_TS_b = getBSONName(EMPTY_USER_FAVORITES_NANO_TS, "UpdateNanoTS") )
var ( USER_ID_EMAIL_USER_ID_b = getBSONName(EMPTY_USER_ID_EMAIL, "UserID") USER_ID_EMAIL_ID_EMAIL_b = getBSONName(EMPTY_USER_ID_EMAIL, "IDEmail") USER_ID_EMAIL_IS_SET_b = getBSONName(EMPTY_USER_ID_EMAIL, "IsSet") USER_ID_EMAIL_UPDATE_NANO_TS_b = getBSONName(EMPTY_USER_ID_EMAIL, "UpdateNanoTS") )
var ( USER_VISIT_USER_ID_b = getBSONName(EMPTY_USER_VISIT, "UserID") USER_VISIT_ACTION_b = getBSONName(EMPTY_USER_VISIT, "Action") USER_VISIT_UPDATE_NANO_TS_b = getBSONName(EMPTY_USER_VISIT, "UpdateNanoTS") )
var ( REDIS_USER_VISIT_COUNT = "user_visit_count" REDIS_USER_VISIT_COUNT_EXP = 10 * time.Minute )
var AccessToken_c *db.Collection
var Article_c *db.Collection
var BoardBanuser_c *db.Collection
var BoardFriend_c *db.Collection
var Board_c *db.Collection
var Client_c *db.Collection
var Comment_c *db.Collection
var ContentBlock_c *db.Collection
var (
DEFAULT_POST_TYPE = []string{"問題", "建議", "討論", "心得", "閒聊", "請益", "情報", "公告"}
)
var EMPTY_ACCESS_TOKEN = &AccessToken{}
var EMPTY_ARTICLE = &Article{}
var (
EMPTY_ARTICLE_COMMENTS = &ArticleComments{}
)
var (
EMPTY_ARTICLE_CONTENT_INFO = &ArticleContentInfo{}
)
var EMPTY_ARTICLE_CONTENT_MTIME = &ArticleContentMTime{}
var EMPTY_ARTICLE_CREATE_QUERY = &ArticleCreateQuery{}
var (
EMPTY_ARTICLE_DETAIL_SUMMARY = &ArticleDetailSummary{}
)
var (
EMPTY_ARTICLE_FIRST_COMMENTS = &ArticleFirstComments{}
)
var (
EMPTY_ARTICLE_N_COMMENTS = &ArticleNComments{}
)
var (
EMPTY_ARTICLE_PERM_INFO = &ArticlePermInfo{}
)
var EMPTY_ARTICLE_QUERY = &ArticleQuery{}
var (
EMPTY_ARTICLE_SUMMARY = &ArticleSummary{}
)
var (
EMPTY_ARTICLE_SUMMARY_WITH_REGEX = &ArticleSummaryWithRegex{}
)
var EMPTY_BOARD = &Board{}
var (
EMPTY_BOARD_BID = &BoardBid{}
)
var (
EMPTY_BOARD_DETAIL = &BoardDetail{}
)
var (
EMPTY_BOARD_ID = &BoardID{}
)
var (
EMPTY_BOARD_PERM_INFO = &BoardPermInfo{}
)
var EMPTY_BOARD_QUERY = &BoardQuery{}
var (
EMPTY_BOARD_SUMMARY = &BoardSummary{}
)
var EMPTY_CLIENT = &Client{}
var EMPTY_COMMENT = &Comment{}
var EMPTY_COMMENT_ARTICLE_QUERY = &CommentArticleQuery{}
var (
EMPTY_COMMENT_DBCS = &CommentDBCS{}
)
var (
EMPTY_COMMENT_IS_DELETED = &CommentIsDeleted{}
)
var (
EMPTY_COMMENT_MD5 = &CommentMD5{}
)
var EMPTY_COMMENT_QUERY = &CommentQuery{}
var (
EMPTY_COMMENT_SORT_TIME = &CommentSortTime{}
)
var (
EMPTY_COMMENT_SUMMARY = &CommentSummary{}
)
var EMPTY_CONTENT_BLOCK = &ContentBlock{}
var EMPTY_CONTENT_BLOCK_QUERY = &ContentBlockQuery{}
var EMPTY_MAN_ARTICLE = &ManArticle{}
var (
EMPTY_MAN_ARTICLE_CONTENT_INFO = &ManArticleContentInfo{}
)
var EMPTY_MAN_ARTICLE_CONTENT_MTIME = &ManArticleContentMTime{}
var (
EMPTY_MAN_ARTICLE_DETAIL_SUMMARY = &ManArticleDetailSummary{}
)
var EMPTY_MAN_ARTICLE_QUERY = &ManArticleQuery{}
var (
EMPTY_MAN_ARTICLE_SUMMARY = &ManArticleSummary{}
)
var EMPTY_RANK = &Rank{}
var EMPTY_USER = &User{}
var EMPTY_USER_ARTICLE = &UserArticle{}
var EMPTY_USER_BOARD = &UserBoard{}
var (
EMPTY_USER_DETAIL = &UserDetail{}
)
var EMPTY_USER_EMAIL = &UserEmail{}
var EMPTY_USER_FAVORITES = &UserFavorites{}
var EMPTY_USER_FAVORITES_META = &UserFavoritesMeta{}
var (
EMPTY_USER_FAVORITES_META_SUMMARY = &UserFavoritesMetaSummary{}
)
var EMPTY_USER_FAVORITES_NANO_TS = &UserFavoritesNanoTS{}
var EMPTY_USER_FAVORITES_QUERY = &UserFavoritesQuery{}
var EMPTY_USER_FAVORITE_ID = &UserFavoriteID{}
var EMPTY_USER_ID_EMAIL = &UserIDEmail{}
var (
EMPTY_USER_INFO_SUMMARY = &UserInfoSummary{}
)
var (
EMPTY_USER_NEW_INFO = &UserNewInfo{}
)
var (
EMPTY_USER_NICKNAME = &UserNickname{}
)
var (
EMPTY_USER_PERM_INFO = &UserPermInfo{}
)
var EMPTY_USER_POSTTIME = &UserPosttime{}
var EMPTY_USER_QUERY = &UserQuery{}
var EMPTY_USER_READ_ARTICLE = &UserReadArticle{}
var EMPTY_USER_READ_ARTICLE_QUERY = &UserReadArticleQuery{}
var EMPTY_USER_READ_BOARD = &UserReadBoard{}
var (
EMPTY_USER_READ_BOARD_QUERY = &UserReadBoardQuery{}
)
var EMPTY_USER_VISIT = &UserVisit{}
var (
IsTest = false
)
var ManArticle_c *db.Collection
var ManContentBlock_c *db.Collection
var Rank_c *db.Collection
var UserAloha_c *db.Collection
var UserArticle_c *db.Collection
var UserBoard_c *db.Collection
var UserEmail_c *db.Collection
var UserFavoritesMeta_c *db.Collection
var UserFavoritesNanoTS_c *db.Collection
var UserFavorites_c *db.Collection
var UserFriend_c *db.Collection
var UserIDEmail_c *db.Collection
var UserReject_c *db.Collection
var UserVisit_c *db.Collection
var User_c *db.Collection
Functions ¶
func CalculateAllUserVisitCounts ¶
CalculateAllUserVisitCounts count recent 10 mins users who are calling login_required_api
func Close ¶
func Close() (err error)
Close
XXX do not really close to avoid db connection-error in tests.
func CountComments ¶
func CreateUserEmail ¶
func CreateUserIDEmail ¶
func DeleteArticles ¶
func DeleteArticles(boardID bbs.BBoardID, articleIDs []bbs.ArticleID, updateNanoTS types.NanoTS) (err error)
DeleteArticles deletes articles in Database
func DeleteCommentsByArticles ¶
func DeleteCommentsByArticles(boardID bbs.BBoardID, articleIDs []bbs.ArticleID, updateNanoTS types.NanoTS) (err error)
DeleteCommentsByArticles deletes all comments in deleted articles
func DeleteRanks ¶
func DeleteRanks(boardID bbs.BBoardID, articleIDs []bbs.ArticleID, updateNanoTS types.NanoTS) (err error)
DeleteRanks deletes ranks in Database
func FavToUserFavorites ¶
func GetUserVisitCount ¶
func GetUserVisitCount() (total int64)
func InitConfig ¶
func InitConfig() error
func RecoverCommentIDs ¶
func RecoverCommentIDs(commentQueries []*CommentQuery) (err error)
RecoverCommentIDs
We need to use $unset to remove IS_DELETED IS_DELETED should never be false. (we use omitempty to avoid this issue.)
func RemoveCommentIDs ¶
func RemoveCommentIDs(bboardID bbs.BBoardID, articleID bbs.ArticleID, toRemoveCommentIDs []types.CommentID, updateNanoTS types.NanoTS, reason string) (err error)
RemoveCommentIDs
Assuming that the data already exists, no need to check that update-nano-ts does not exists.
func ResetArticleIsBottom ¶
func SetUserVisitCount ¶
SetUserVisitCount try to set user visit count to redis
func TwoFactorSerializeValue ¶
func UnsetIsTest ¶
func UnsetIsTest()
func UpdateAccessToken ¶
func UpdateAccessToken(accessToken *AccessToken) (err error)
func UpdateArticleComments ¶
func UpdateArticleComments(articleComments *ArticleComments) (err error)
UpdateArticleComments
We've already have article-content-info, we don't do create UpdateArticleComments
func UpdateArticleFirstComments ¶
func UpdateArticleFirstComments(articleFirstComments *ArticleFirstComments) (err error)
func UpdateArticleRank ¶
func UpdateArticleSummaries ¶
func UpdateArticleSummaries(articleSummaries []*ArticleSummary, updateNanoTS types.NanoTS) (err error)
func UpdateArticleSummaryWithRegexes ¶
func UpdateArticleSummaryWithRegexes(articleSummaryWithRegexes []*ArticleSummaryWithRegex, updateNanoTS types.NanoTS) (err error)
func UpdateBoardDetails ¶
func UpdateBoardDetails(boardDetails []*BoardDetail, updateNanoTS types.NanoTS) (err error)
func UpdateBoardSummaries ¶
func UpdateBoardSummaries(boardSummaries []*BoardSummary, updateNanoTS types.NanoTS) (err error)
func UpdateClient ¶
func UpdateCommentSummaries ¶
func UpdateComments ¶
UpdateComments
XXX hack in updateCommentsCore:
treat all the comments as non-deleted and unset IsDeleted.
func UpdateContentBlocks ¶
func UpdateContentBlocks(contentBlocks []*ContentBlock, updateNanoTS types.NanoTS) (err error)
func UpdateManArticleContentInfo ¶
func UpdateManArticleContentInfo(bboardID bbs.BBoardID, articleID types.ManArticleID, contentInfo *ManArticleContentInfo) (err error)
func UpdateManArticleSummaries ¶
func UpdateManArticleSummaries(articleSummaries []*ManArticleSummary, updateNanoTS types.NanoTS) (err error)
func UpdateManContentBlocks ¶
func UpdateManContentBlocks(contentBlocks []*ContentBlock, updateNanoTS types.NanoTS) (err error)
func UpdateRank ¶
func UpdateUserDetail ¶
func UpdateUserDetail(user *UserDetail) (err error)
func UpdateUserEmailIsSet ¶
func UpdateUserFavorites ¶
func UpdateUserFavoritesMeta ¶
func UpdateUserFavoritesMeta(meta *UserFavoritesMeta) (err error)
func UpdateUserIDEmailIsSet ¶
func UpdateUserPosttime ¶ added in v0.36.0
func UpdateUserReadArticle ¶
func UpdateUserReadArticle(userReadArticle *UserReadArticle) (err error)
func UpdateUserReadArticles ¶
func UpdateUserReadArticles(userReadArticles []*UserReadArticle, updateNanoTS types.NanoTS) (err error)
func UpdateUserReadBoard ¶
func UpdateUserReadBoard(userReadBoard *UserReadBoard) (err error)
func UpdateUserReadBoards ¶
func UpdateUserReadBoards(userReadBoards []*UserReadBoard, updateNanoTS types.NanoTS) (err error)
func UpdateUserVisit ¶
UpdateUserVisit updates user_visit's document data
func UserFavoritesToFav ¶
func UserFavoritesToFav(meta *FolderMeta, userFavorites []*UserFavorites, depth int) (f *fav.Fav, err error)
Types ¶
type AccessToken ¶
type AccessToken struct { AccessToken string `bson:"access_token"` UserID bbs.UUserID `bson:"user_id"` UpdateNanoTS types.NanoTS `bson:"update_nano_ts"` }
func NewAccessToken ¶
type Article ¶
type Article struct { Version int `bson:"version"` BBoardID bbs.BBoardID `bson:"bid"` // ArticleID bbs.ArticleID `bson:"aid"` // BoardArticleID types.BoardArticleID `bson:"baid"` IsDeleted bool `bson:"deleted,omitempty"` // Filename string `bson:"filename"` // CreateTime types.NanoTS `bson:"create_time_nano_ts"` // MTime types.NanoTS `bson:"mtime_nano_ts"` // Recommend int `bson:"recommend"` // Owner bbs.UUserID `bson:"owner"` // FullTitle string `bson:"full_title"` Title string `bson:"title"` // Money int `bson:"money"` // Class string `bson:"class"` // Filemode ptttype.FileMode `bson:"mode"` // TitleRegex []string `bson:"title_regex"` Idx string `bson:"pttidx"` UpdateNanoTS types.NanoTS `bson:"update_nano_ts"` // used by article-summary ContentMTime types.NanoTS `bson:"content_mtime_nano_ts"` // ContentMD5 string `bson:"content_md5"` ContentID types.ContentID `bson:"content_id"` Content [][]*types.Rune `bson:"content"` // ContentPrefix [][]*types.Rune `bson:"content_prefix"` // IP string `bson:"ip"` // Host string `bson:"host"` // ip 的中文呈現, 外國則為國家. BBS string `bson:"bbs"` // ContentUpdateNanoTS types.NanoTS `bson:"content_update_nano_ts"` SignatureDBCS []byte `bson:"signature_dbcs"` SignatureMD5 string `bson:"signature_md5"` FirstCommentsMD5 string `bson:"first_comments_md5"` FirstCommentsLastTime types.NanoTS `bson:"first_comments_last_time_nano_ts"` FirstCommentsUpdateNanoTS types.NanoTS `bson:"first_comments_update_nano_ts"` NComments int `bson:"n_comments"` CommentsUpdateNanoTS types.NanoTS `bson:"comments_update_nano_ts"` Rank int `bson:"rank"` // 評價 RankToUpdateNanoTS types.NanoTS `bson:"rank_to_update_nano_ts"` RankUpdateNanoTS types.NanoTS `bson:"rank_update_nano_ts"` SubjectType ptttype.SubjectType `bson:"subject_type"` IsBottom bool `bson:"is_bottom"` }
type ArticleComments ¶
type ArticleContentInfo ¶
type ArticleContentInfo struct { ContentMD5 string `bson:"content_md5"` ContentID types.ContentID `bson:"content_id"` Content [][]*types.Rune `bson:"content"` ContentPrefix [][]*types.Rune `bson:"content_prefix"` // IP string `bson:"ip"` Host string `bson:"host"` // ip 的中文呈現, 外國則為國家. BBS string `bson:"bbs"` ContentUpdateNanoTS types.NanoTS `bson:"content_update_nano_ts"` SignatureDBCS []byte `bson:"signature_dbcs"` SignatureMD5 string `bson:"signature_md5"` IsDeleted bool `bson:"deleted,omitempty"` // }
ContentInfo
func GetArticleContentInfo ¶
type ArticleContentMTime ¶
type ArticleContentMTime struct { ContentMTime types.NanoTS `bson:"content_mtime_nano_ts"` IsDeleted bool `bson:"deleted,omitempty"` // }
ContentMTime
func GetArticleContentMTime ¶
type ArticleCreateQuery ¶ added in v0.36.0
type ArticleDetailSummary ¶
type ArticleDetailSummary struct { BBoardID bbs.BBoardID `bson:"bid"` ArticleID bbs.ArticleID `bson:"aid"` BoardArticleID types.BoardArticleID `bson:"baid"` IsDeleted bool `bson:"deleted,omitempty"` CreateTime types.NanoTS `bson:"create_time_nano_ts"` MTime types.NanoTS `bson:"mtime_nano_ts"` Recommend int `bson:"recommend"` Owner bbs.UUserID `bson:"owner"` Title string `bson:"title"` Money int `bson:"money"` Class string `bson:"class"` Filemode ptttype.FileMode `bson:"mode"` UpdateNanoTS types.NanoTS `bson:"update_nano_ts"` ContentMTime types.NanoTS `bson:"content_mtime_nano_ts"` ContentMD5 string `bson:"content_md5"` ContentID types.ContentID `bson:"content_id"` ContentUpdateNanoTS types.NanoTS `bson:"content_update_nano_ts"` FirstCommentsMD5 string `bson:"first_comments_md5"` FirstCommentsLastTime types.NanoTS `bson:"first_comments_last_time_nano_ts"` FirstCommentsUpdateNanoTS types.NanoTS `bson:"first_comments_update_nano_ts"` NComments int `bson:"n_comments"` CommentsUpdateNanoTS types.NanoTS `bson:"comments_update_nano_ts"` IP string `bson:"ip"` // Host string `bson:"host"` // ip 的中文呈現, 外國則為國家. BBS string `bson:"bbs"` // Rank int `bson:"rank"` // 評價 RankUpdateNanoTS types.NanoTS `bson:"rank_update_nano_ts"` Idx string `bson:"pttidx"` }
ArticleDetailSummary
func GetArticleDetailSummary ¶
type ArticleEditSummary ¶
type ArticleEditSummary struct { MTime types.NanoTS `bson:"mtime_nano_ts"` FullTitle string `bson:"full_title"` Title string `bson:"title"` TitleRegex []string `bson:"title_regex"` Class string `bson:"class"` UpdateNanoTS types.NanoTS `bson:"update_nano_ts"` }
func NewArticleEditSummary ¶
type ArticleFirstComments ¶
type ArticleFirstComments struct { BBoardID bbs.BBoardID `bson:"bid"` // ArticleID bbs.ArticleID `bson:"aid"` // FirstCommentsMD5 string `bson:"first_comments_md5"` FirstCommentsLastTime types.NanoTS `bson:"first_comments_last_time_nano_ts"` FirstCommentsUpdateNanoTS types.NanoTS `bson:"first_comments_update_nano_ts"` IsDeleted bool `bson:"deleted,omitempty"` // }
type ArticleIsDeleted ¶
type ArticleNComments ¶
type ArticleNComments struct { // ArticleSummary BBoardID bbs.BBoardID `bson:"bid"` ArticleID bbs.ArticleID `bson:"aid"` NComments int `bson:"n_comments,omitempty"` // n_comments is read-only in article-summary. Rank int `bson:"rank,omitempty"` // 評價 }
func GetArticleNCommentsByArticleIDs ¶
func GetArticleNCommentsByArticleIDs(bboardID bbs.BBoardID, articleIDs []bbs.ArticleID) (articleNComments []*ArticleNComments, err error)
GetArticleNCommentsByArticleIDs
type ArticlePermInfo ¶ added in v0.36.0
type ArticlePermInfo struct { BBoardID bbs.BBoardID `bson:"bid"` // ArticleID bbs.ArticleID `bson:"aid"` // BoardArticleID types.BoardArticleID `bson:"baid"` Owner bbs.UUserID `bson:"owner"` // IsDeleted bool `bson:"deleted,omitempty"` // }
func GetArticlePermInfo ¶ added in v0.36.0
func GetArticlesPermInfo ¶ added in v0.36.0
type ArticleQuery ¶
type ArticleRank ¶
type ArticleSummary ¶
type ArticleSummary struct { // ArticleSummary BBoardID bbs.BBoardID `bson:"bid"` ArticleID bbs.ArticleID `bson:"aid"` BoardArticleID types.BoardArticleID `bson:"baid"` IsDeleted bool `bson:"deleted,omitempty"` CreateTime types.NanoTS `bson:"create_time_nano_ts"` MTime types.NanoTS `bson:"mtime_nano_ts"` Recommend int `bson:"recommend"` Owner bbs.UUserID `bson:"owner"` FullTitle string `bson:"full_title"` Title string `bson:"title"` Money int `bson:"money"` Class string `bson:"class"` Filemode ptttype.FileMode `bson:"mode"` Idx string `bson:"pttidx"` UpdateNanoTS types.NanoTS `bson:"update_nano_ts"` NComments int `bson:"n_comments,omitempty"` // n_comments is read-only in article-summary. Rank int `bson:"rank,omitempty"` // 評價, read-only SubjectType ptttype.SubjectType `bson:"subject_type"` IsBottom bool `bson:"is_bottom"` }
ArticleSummary
func GetArticleSummaries ¶
func GetArticleSummariesByBoardArticleIDs ¶ added in v0.36.0
func GetArticleSummariesByBoardArticleIDs(boardArticleIDs []types.BoardArticleID) (result []*ArticleSummary, err error)
func GetArticleSummary ¶
func GetBottomArticleSummaries ¶
func GetBottomArticleSummaries(boardID bbs.BBoardID) (result []*ArticleSummary, err error)
func NewArticleSummary ¶
func NewArticleSummary(a_b *bbs.ArticleSummary, updateNanoTS types.NanoTS) *ArticleSummary
NewARticleSummary
no n_comments in bbs.ArticleSummary from backend.
type ArticleSummaryWithRegex ¶
type ArticleSummaryWithRegex struct { // ArticleSummary BBoardID bbs.BBoardID `bson:"bid"` ArticleID bbs.ArticleID `bson:"aid"` BoardArticleID types.BoardArticleID `bson:"baid"` IsDeleted bool `bson:"deleted,omitempty"` CreateTime types.NanoTS `bson:"create_time_nano_ts"` MTime types.NanoTS `bson:"mtime_nano_ts"` Recommend int `bson:"recommend"` Owner bbs.UUserID `bson:"owner"` FullTitle string `bson:"full_title"` Title string `bson:"title"` Money int `bson:"money"` Class string `bson:"class"` Filemode ptttype.FileMode `bson:"mode"` TitleRegex []string `bson:"title_regex"` Idx string `bson:"pttidx"` UpdateNanoTS types.NanoTS `bson:"update_nano_ts"` NComments int `bson:"n_comments,omitempty"` // n_comments is read-only in article-summary. Rank int `bson:"rank,omitempty"` // 評價, read-only SubjectType ptttype.SubjectType `bson:"subject_type"` IsBottom bool `bson:"is_bottom"` }
ArticleSummaryWithRegex
func NewArticleSummaryWithRegex ¶
func NewArticleSummaryWithRegex(a_b *bbs.ArticleSummary, updateNanoTS types.NanoTS) *ArticleSummaryWithRegex
NewArticleSummaryWithRegex
no n_comments in bbs.ArticleSummary from backend.
func NewArticleSummaryWithRegexFromPBArticle ¶
func NewArticleSummaryWithRegexFromPBArticle(boardID bbs.BBoardID, a_b *boardd.Post, updateNanoTS types.NanoTS, isBottom bool) *ArticleSummaryWithRegex
NewArticleSummaryWithRegexFromPBArticle
no n_comments in bbs.ArticleSummary from backend.
type Board ¶
type Board struct { Version int `bson:"version"` BBoardID bbs.BBoardID `bson:"bid"` Brdname string `bson:"brdname"` Title string `bson:"title"` BrdAttr ptttype.BrdAttr `bson:"flag"` BoardType string `bson:"the_type"` Category string `bson:"class"` NUser int `bson:"nuser"` /* use aggregate to periodically get the data */ BMs []bbs.UUserID `bson:"bms"` Total int `bson:"total"` /* total articles, 需要即時知道. 因為 read 頻率高. 並且跟 last-post-time-ts 一樣 write 頻率 << read 頻率 */ LastPostTime types.NanoTS `bson:"last_post_time_nano_ts"` /* 需要即時知道來做板的已讀 */ UpdateTime types.NanoTS `bson:"update_time_nano_ts"` /* show 進板畫面, 目前只有 INT_MAX - 1 或 0 */ VoteLimitLogins int `bson:"vote_limit_logins"` PostLimitLogins int `bson:"post_limit_logins"` VoteLimitBadpost int `bson:"vote_limit_bad_post"` PostLimitBadpost int `bson:"post_limit_bad_post"` ParentID bbs.BBoardID `bson:"parent"` NVote int `bson:"vote"` /* use db-count to get current #vote */ VoteClosingTime types.NanoTS `bson:"vtime_nano_ts"` Level ptttype.PERM `bson:"perm"` LastSetTime types.NanoTS `bson:"last_set_time_nano_ts"` /* perm-reload */ PostExpire ptttype.Bid `bson:"post_expire"` /* 看板連結的 bid */ PostType []string `bson:"post_type"` PostTemplate []bool `bson:"post_tmpl"` EndGambleNanoTS types.NanoTS `bson:"end_gamble_nano_ts"` FastRecommendPause types.NanoTS `bson:"fast_recommend_pause_nano_ts"` IsDeleted bool `bson:"deleted,omitempty"` UpdateNanoTS types.NanoTS `bson:"update_nano_ts"` Gid ptttype.Bid `bson:"pttgid"` Bid ptttype.Bid `bson:"pttbid"` IdxByName string `bson:"pttidxname"` IdxByClass string `bson:"pttidxclass"` ChessCountry ptttype.ChessCode `bson:"chesscountry"` }
type BoardBanUser ¶
type BoardBid ¶
type BoardDetail ¶
type BoardDetail struct { BBoardID bbs.BBoardID `bson:"bid"` Brdname string `bson:"brdname"` Title string `bson:"title"` BrdAttr ptttype.BrdAttr `bson:"flag"` BoardType string `bson:"the_type"` Category string `bson:"class"` NUser int `bson:"nuser"` /* use aggregate to periodically get the data */ BMs []bbs.UUserID `bson:"bms"` Total int `bson:"total"` /* total articles, 需要即時知道. 因為 read 頻率高. 並且跟 last-post-time-ts 一樣 write 頻率 << read 頻率 */ LastPostTime types.NanoTS `bson:"last_post_time_nano_ts"` /* 需要即時知道來做板的已讀 */ UpdateTime types.NanoTS `bson:"update_time_nano_ts"` /* show 進板畫面, 目前只有 INT_MAX - 1 或 0 */ VoteLimitLogins int `bson:"vote_limit_logins"` PostLimitLogins int `bson:"post_limit_logins"` VoteLimitBadpost int `bson:"vote_limit_bad_post"` PostLimitBadpost int `bson:"post_limit_bad_post"` ParentID bbs.BBoardID `bson:"parent"` NVote int `bson:"vote"` /* use db-count to get current #vote */ VoteClosingTime types.NanoTS `bson:"vtime_nano_ts"` Level ptttype.PERM `bson:"perm"` LastSetTime types.NanoTS `bson:"last_set_time_nano_ts"` /* perm-reload */ PostExpire ptttype.Bid `bson:"post_expire"` /* 看板連結的 bid */ PostType []string `bson:"post_type"` PostTemplate []bool `bson:"post_tmpl"` EndGambleNanoTS types.NanoTS `bson:"end_gamble_nano_ts"` FastRecommendPause types.NanoTS `bson:"fast_recommend_pause_nano_ts"` IsDeleted bool `bson:"deleted,omitempty"` UpdateNanoTS types.NanoTS `bson:"update_nano_ts"` Gid ptttype.Bid `bson:"pttgid"` Bid ptttype.Bid `bson:"pttbid"` IdxByName string `bson:"pttidxname"` IdxByClass string `bson:"pttidxclass"` ChessCountry ptttype.ChessCode `bson:"chesscountry"` }
func GetBoardDetail ¶
func NewBoardDetail ¶
func NewBoardDetail(b_b *bbs.BoardDetail, updateNanoTS types.NanoTS) *BoardDetail
type BoardFriend ¶
type BoardPermInfo ¶ added in v0.36.0
type BoardPermInfo struct { BBoardID bbs.BBoardID `bson:"bid"` Brdname string `bson:"brdname"` BrdAttr ptttype.BrdAttr `bson:"flag"` BMs []bbs.UUserID `bson:"bms"` Level ptttype.PERM `bson:"perm"` ParentID bbs.BBoardID `bson:"parent"` VoteLimitLogins int `bson:"vote_limit_logins"` VoteLimitBadpost int `bson:"vote_limit_bad_post"` PostLimitLogins int `bson:"post_limit_logins"` PostLimitBadpost int `bson:"post_limit_bad_post"` NUser int `bson:"nuser"` /* use aggregate to periodically get the data */ }
BoardPermInfo
Information related to Board permission
func GetBoardPermInfo ¶ added in v0.36.0
func GetBoardPermInfo(boardID bbs.BBoardID) (boardPermInfo *BoardPermInfo, err error)
type BoardQuery ¶
type BoardSummary ¶
type BoardSummary struct { BBoardID bbs.BBoardID `bson:"bid"` Brdname string `bson:"brdname"` Title string `bson:"title"` BrdAttr ptttype.BrdAttr `bson:"flag"` BoardType string `bson:"the_type"` Category string `bson:"class"` NUser int `bson:"nuser"` BMs []bbs.UUserID `bson:"bms"` Total int `bson:"total"` /* total articles, 需要即時知道. 因為 read 頻率高. 並且跟 last-post-time-ts 一樣 write 頻率 << read 頻率 */ LastPostTime types.NanoTS `bson:"last_post_time_nano_ts"` /* 需要即時知道來做板的已讀 */ IsDeleted bool `bson:"deleted,omitempty"` UpdateNanoTS types.NanoTS `bson:"update_nano_ts"` ParentID bbs.BBoardID `bson:"parent"` Gid ptttype.Bid `bson:"pttgid"` Bid ptttype.Bid `bson:"pttbid"` IdxByName string `bson:"pttidxname"` IdxByClass string `bson:"pttidxclass"` }
BoardSummary
func GetBoardSummary ¶
func GetBoardSummary(bboardID bbs.BBoardID) (result *BoardSummary, err error)
func NewBoardSummary ¶
func NewBoardSummary(b_b *bbs.BoardSummary, updateNanoTS types.NanoTS) *BoardSummary
func NewBoardSummaryFromPBBoard ¶
func NewBoardSummaryFromPBBoard(b_b *boardd.Board, updateNanoTS types.NanoTS) *BoardSummary
type Client ¶
type Comment ¶
type Comment struct { BBoardID bbs.BBoardID `bson:"bid"` ArticleID bbs.ArticleID `bson:"aid"` //XXX currently it's very hard to maintain the comment-id. //if we do comment-id only based on MD5: // got duplicated md5-id if the owner posts the same comments // within 1 min. // //if we add the inferred CreateTime into the comment-id: // the CreateTime may be changed if the author deletes // some other comments within same minute. CommentID types.CommentID `bson:"cid"` TheType ptttype.CommentType `bson:"type"` RefIDs []types.CommentID `bson:"refids"` IsDeleted bool `bson:"deleted,omitempty"` DeleteReason string `bson:"delete_reason,omitempty"` CreateTime types.NanoTS `bson:"create_time_nano_ts"` Owner bbs.UUserID `bson:"owner"` Content [][]*types.Rune `bson:"content"` // content in comment is colorless. IP string `bson:"ip"` Host string `bson:"host"` // ip 的中文呈現, 外國則為國家. MD5 string `bson:"md5"` FirstCreateTime types.NanoTS `bson:"first_create_time_nano_ts,omitempty"` // create-time from first-comments. InferredCreateTime types.NanoTS `bson:"inferred_create_time_nano_ts,omitempty"` // create-time from inferred. NewCreateTime types.NanoTS `bson:"new_create_time_nano_ts,omitempty"` // create-time from new comment. SortTime types.NanoTS `bson:"sort_time_nano_ts"` TheDate string `bson:"the_date"` DBCS []byte `json:"-" bson:"dbcs"` DBCSStr string `json:"-" bson:"dbcsstr"` EditNanoTS types.NanoTS `bson:"edit_nano_ts"` // for reply. UpdateNanoTS types.NanoTS `bson:"update_nano_ts"` }
func GetComments ¶
func GetComments(boardID bbs.BBoardID, articleID bbs.ArticleID, sortNanoTS types.NanoTS, commentID types.CommentID, descending bool, limit int) (comments []*Comment, err error)
GetComments
func (*Comment) CleanComment ¶
func (c *Comment) CleanComment()
func (*Comment) CleanReply ¶
func (c *Comment) CleanReply()
func (*Comment) SetSortTime ¶
type CommentArticleQuery ¶
type CommentDBCS ¶
type CommentDBCS struct { BBoardID bbs.BBoardID `bson:"bid"` ArticleID bbs.ArticleID `bson:"aid"` CommentID types.CommentID `bson:"cid"` SortTime types.NanoTS `bson:"sort_time_nano_ts"` DBCS []byte `bson:"dbcs"` }
func GetAllCommentDBCSs ¶
type CommentIsDeleted ¶
type CommentMD5 ¶
type CommentMD5 struct { BBoardID bbs.BBoardID `bson:"bid"` ArticleID bbs.ArticleID `bson:"aid"` CommentID types.CommentID `bson:"cid"` TheType ptttype.CommentType `bson:"type"` CreateTime types.NanoTS `bson:"create_time_nano_ts"` MD5 string `bson:"md5"` FirstCreateTime types.NanoTS `bson:"first_create_time_nano_ts,omitempty"` // create-time from first-comments. InferredCreateTime types.NanoTS `bson:"inferred_create_time_nano_ts,omitempty"` // create-time from inferred. NewCreateTime types.NanoTS `bson:"new_create_time_nano_ts,omitempty"` // create-time from new comment. SortTime types.NanoTS `bson:"sort_time_nano_ts"` TheDate string `bson:"the_date"` EditNanoTS types.NanoTS `bson:"edit_nano_ts"` // for reply. }
func GetAllCommentMD5s ¶
type CommentQuery ¶
type CommentSortTime ¶
type CommentSummary ¶
type CommentSummary struct { BBoardID bbs.BBoardID `bson:"bid"` ArticleID bbs.ArticleID `bson:"aid"` CommentID types.CommentID `bson:"cid"` TheType ptttype.CommentType `bson:"type"` IsDeleted bool `bson:"deleted,omitempty"` CreateTime types.NanoTS `bson:"create_time_nano_ts"` Owner bbs.UUserID `bson:"owner"` UpdateNanoTS types.NanoTS `bson:"update_nano_ts"` Content [][]*types.Rune `bson:"content"` // content in comment is SortTime types.NanoTS `bson:"sort_time_nano_ts"` }
func GetCommentSummaries ¶
func GetCommentSummaries(bboardID bbs.BBoardID, articleID bbs.ArticleID, startNanoTS types.NanoTS, endNanoTS types.NanoTS) (commentSummaries []*CommentSummary, err error)
GetCommentSummaries
get comment summaries with startNanoTS <= createTime < endNanoTS (excluding endNanoTS)
type ContentBlock ¶
type ContentBlock struct { BBoardID bbs.BBoardID `bson:"bid"` // ArticleID bbs.ArticleID `bson:"aid"` // ContentID types.ContentID `bson:"Cid"` Idx int `bson:"idx"` IsDeleted bool `bson:"deleted,omitempty"` // Content [][]*types.Rune `bson:"content"` // UpdateNanoTS types.NanoTS `bson:"update_nano_ts"` }
func GetAllContentBlocks ¶
func GetAllManContentBlocks ¶
func GetAllManContentBlocks(boardID bbs.BBoardID, articleID types.ManArticleID, contentID types.ContentID) (contentBlocks []*ContentBlock, err error)
func GetContentBlock ¶
func GetContentBlocks ¶
func GetManContentBlock ¶
func GetManContentBlock(boardID bbs.BBoardID, articleID types.ManArticleID, contentID types.ContentID, idx int) (contentBlock *ContentBlock, err error)
func GetManContentBlocks ¶
func GetManContentBlocks(boardID bbs.BBoardID, articleID types.ManArticleID, contentID types.ContentID, startIdx int, n int64) (contentBlocks []*ContentBlock, err error)
type ContentBlockQuery ¶
type FolderMeta ¶
type ManArticle ¶
type ManArticle struct { Version int `bson:"version"` BBoardID bbs.BBoardID `bson:"bid"` // ArticleID types.ManArticleID `bson:"aid"` // LevelIdx types.ManArticleID `bson:"level_idx"` // IsDeleted bool `bson:"deleted,omitempty"` // CreateTime types.NanoTS `bson:"create_time_nano_ts"` // MTime types.NanoTS `bson:"mtime_nano_ts"` Title string `bson:"title"` // Filemode ptttype.FileMode `bson:"mode"` // IsDir bool `bson:"is_dir"` UpdateNanoTS types.NanoTS `bson:"update_nano_ts"` // used by article-summary ContentMTime types.NanoTS `bson:"content_mtime_nano_ts"` // ContentMD5 string `bson:"content_md5"` ContentID types.ContentID `bson:"content_id"` Content [][]*types.Rune `bson:"content"` ContentUpdateNanoTS types.NanoTS `bson:"content_update_nano_ts"` Idx int `bson:"pttidx"` }
type ManArticleContentInfo ¶
type ManArticleContentInfo struct { ContentMD5 string `bson:"content_md5"` ContentID types.ContentID `bson:"content_id"` Content [][]*types.Rune `bson:"content"` ContentUpdateNanoTS types.NanoTS `bson:"content_update_nano_ts"` }
func GetManArticleContentInfo ¶
func GetManArticleContentInfo(bboardID bbs.BBoardID, articleID types.ManArticleID, isContent bool) (contentInfo *ManArticleContentInfo, err error)
type ManArticleContentMTime ¶
type ManArticleContentMTime struct { ContentMTime types.NanoTS `bson:"content_mtime_nano_ts"` IsDeleted bool `bson:"deleted,omitempty"` // }
func GetManArticleContentMTime ¶
func GetManArticleContentMTime(bboardID bbs.BBoardID, articleID types.ManArticleID) (ret *ManArticleContentMTime, err error)
type ManArticleDetailSummary ¶
type ManArticleDetailSummary struct { BBoardID bbs.BBoardID `bson:"bid"` // ArticleID types.ManArticleID `bson:"aid"` // IsDeleted bool `bson:"deleted,omitempty"` // LevelIdx types.ManArticleID `bson:"level_idx"` // CreateTime types.NanoTS `bson:"create_time_nano_ts"` // MTime types.NanoTS `bson:"mtime_nano_ts"` Title string `bson:"title"` // IsDir bool `bson:"is_dir"` UpdateNanoTS types.NanoTS `bson:"update_nano_ts"` // used by article-summary ContentMTime types.NanoTS `bson:"content_mtime_nano_ts"` // ContentMD5 string `bson:"content_md5"` ContentID types.ContentID `bson:"content_id"` ContentUpdateNanoTS types.NanoTS `bson:"content_update_nano_ts"` Idx int `bson:"pttidx"` }
func GetManArticleDetailSummaries ¶
func GetManArticleDetailSummaries(boardID bbs.BBoardID, levelIdx types.ManArticleID) (result []*ManArticleDetailSummary, err error)
func GetManArticleDetailSummary ¶
func GetManArticleDetailSummary(bboardID bbs.BBoardID, articleID types.ManArticleID) (result *ManArticleDetailSummary, err error)
type ManArticleQuery ¶
type ManArticleQuery struct { BBoardID bbs.BBoardID `bson:"bid"` LevelIdx types.ManArticleID `bson:"level_idx"` // Idx int `bson:"pttidx"` }
type ManArticleSummary ¶
type ManArticleSummary struct { BBoardID bbs.BBoardID `bson:"bid"` // ArticleID types.ManArticleID `bson:"aid"` // LevelIdx types.ManArticleID `bson:"level_idx"` // CreateTime types.NanoTS `bson:"create_time_nano_ts"` // MTime types.NanoTS `bson:"mtime_nano_ts"` Title string `bson:"title"` // IsDir bool `bson:"is_dir"` UpdateNanoTS types.NanoTS `bson:"update_nano_ts"` // used by article-summary Idx int `bson:"pttidx"` }
func GetManArticleSummaries ¶
func GetManArticleSummaries(boardID bbs.BBoardID, LevelIdx types.ManArticleID) (result []*ManArticleSummary, err error)
func NewManArticleSummaryFromPB ¶
func NewManArticleSummaryFromPB(entry *mand.Entry, boardID bbs.BBoardID, levelIdx types.ManArticleID, updateNanoTS types.NanoTS, idx int) (articleSummary *ManArticleSummary)
type RankAgged ¶
type RankIsDeleted ¶
type User ¶
type User struct { Version int `bson:"version"` UserID bbs.UUserID `bson:"user_id"` Username string `bson:"username"` Realname string `bson:"realtime"` Nickname string `bson:"nickname"` Uflag ptttype.UFlag `bson:"flag"` Userlevel ptttype.PERM `bson:"perm"` Numlogindays int `bson:"login_days"` /* 考慮透過 db-count, 但是可能無法跟以前版本相容 */ Numposts int `bson:"posts"` /* 考慮透過 db-count, 因為 post 可能會被消失, 但是這個欄位不應該因為被消失的而減少? (poster 主動消失的需要減少)? */ Firstlogin types.NanoTS `bson:"first_login_nano_ts"` Lastlogin types.NanoTS `bson:"last_login_nano_ts"` /* 考慮透過 db-max, 但是可能在拉 user-detail 時會花很多時間. */ LastIP string `bson:"last_ip"` LastHost string `bson:"last_host"` // last-ip 的中文呈現, 外國則為國家. Money int `bson:"money"` PttEmail string `bson:"pttemail"` Justify string `bson:"justify"` Over18 bool `bson:"over18"` PagerUIType uint8 `bson:"pager_ui"` /* 呼叫器界面類別 (was: WATER_*) */ Pager ptttype.PagerMode `bson:"pager"` /* 呼叫器狀態 */ Invisible bool `bson:"hide"` Exmailbox uint32 `bson:"exmail"` Career string `bson:"career"` Role uint32 `bson:"role"` LastSeen types.NanoTS `bson:"last_seen_nano_ts"` TimeSetAngel types.NanoTS `bson:"time_set_angel_nano_ts"` TimePlayAngel types.NanoTS `bson:"time_play_angel_nano_ts"` LastSong types.NanoTS `bson:"last_song_nano_ts"` LoginView uint32 `bson:"login_view"` Vlcount int `bson:"violation"` FiveWin int `bson:"five_win"` FiveLose int `bson:"five_lose"` FiveTie int `bson:"five_tie"` ChcWin int `bson:"chc_win"` ChcLose int `bson:"chc_lose"` ChcTie int `bson:"chc_tie"` Conn6Win int `bson:"conn6_win"` Conn6Lose int `bson:"conn6_lose"` Conn6Tie int `bson:"conn6_tie"` GoWin int `bson:"go_win"` GoLose int `bson:"go_lose"` GoTie int `bson:"go_tie"` DarkWin int `bson:"dark_win"` DarkLose int `bson:"dark_lose"` DarkTie int `bson:"dark_tie"` /* 暗棋戰績 和 */ UaVersion uint8 `bson:"ua_version"` Signature uint8 `bson:"signaure"` /* 慣用簽名檔 */ BadPost int `bson:"bad_post"` /* 評價為壞文章數 */ MyAngel bbs.UUserID `bson:"angel"` /* 我的小天使 */ ChessEloRating int `bson:"chess_rank"` /* 象棋等級 */ TimeRemoveBadPost types.NanoTS `bson:"time_remove_bad_post_nano_ts"` TimeViolateLaw types.NanoTS `bson:"time_violate_law_nano_ts"` IsDeleted bool `bson:"deleted,omitempty"` UpdateNanoTS types.NanoTS `bson:"update_nano_ts"` UserLevel2 ptttype.PERM2 `bson:"perm2"` UpdateNanoTS2 types.NanoTS `bson:"update_nano_ts2"` // NFriend int `bson:"n_friend"` /* 需要透過 db-count */ Avatar []byte `bson:"avatar"` AvatarNanoTS types.NanoTS `bson:"avatar_nano_ts"` CooldownNanoTS types.NanoTS `bson:"cooldown_nano_ts"` CooldownUpdateNanoTS types.NanoTS `bson:"cooldown_update_nano_ts"` Posttime int `bson:"postitme"` PosttimeUpdateNanoTS types.NanoTS `bson:"posttime_update_nano_ts"` }
type UserArticle ¶ added in v0.36.0
type UserArticle struct { UserID bbs.UUserID `bson:"user_id"` BoardID bbs.BBoardID `bson:"bid"` ArticleID bbs.ArticleID `bson:"aid"` BoardArticleID types.BoardArticleID `bson:"baid"` ReadUpdateNanoTS types.NanoTS `bson:"update_nano_ts"` ArticleBlocked bool `bson:"article_blocked"` // 不看這篇文章 ArticleBlockedReason string `bson:"article_blocked_reason"` ArticleBlockedUpdateNanoTS types.NanoTS `bson:"article_blocked_update_nano_ts"` ArticleReported bool `bson:"article_reported"` // 檢舉這篇文章 ArticleReportedReason string `bson:"article_reported_reason"` ArticleReportedUpdateNanoTS types.NanoTS `bson:"article_reported_update_nano_ts"` }
func FindUserArticles ¶ added in v0.36.0
type UserBoard ¶ added in v0.36.0
type UserBoard struct { UserID bbs.UUserID `bson:"user_id"` BBoardID bbs.BBoardID `bson:"bid"` ReadUpdateNanoTS types.NanoTS `bson:"update_nano_ts"` BoardFriend bool `bson:"board_friend"` BoardFriendUpdateNanoTS types.NanoTS `bson:"board_friend_update_nano_ts"` BoardBucketExpireNanoTS types.NanoTS `bson:"board_bucket_expire_nano_ts"` // 水桶 BoardBucketReason string `bson:"board_bucket_reason"` BoardBucketUpdateNanoTS types.NanoTS `bson:"board_bucket_update_nano_ts"` BoardBlocked bool `bson:"board_blocked"` // 不看這個板 BoardBlockedReason string `bson:"board_blocked_reason"` BoardBlockedUpdateNanoTS types.NanoTS `bson:"board_blocked_update_nano_ts"` BoardReported bool `bson:"board_reported"` // 檢舉這個板 BoardReportedReason string `bson:"board_reported_reason"` BoardReportedUpdateNanoTS types.NanoTS `bson:"board_reported_update_nano_ts"` }
func FindUserBoard ¶ added in v0.36.0
type UserDetail ¶
type UserDetail struct { UserID bbs.UUserID `bson:"user_id"` Username string `bson:"username"` Realname string `bson:"realtime"` Nickname string `bson:"nickname"` Uflag ptttype.UFlag `bson:"flag"` Userlevel ptttype.PERM `bson:"perm"` Numlogindays int `bson:"login_days"` /* 考慮透過 db-count, 但是可能無法跟以前版本相容 */ Numposts int `bson:"posts"` /* 考慮透過 db-count, 因為 post 可能會被消失, 但是這個欄位不應該因為被消失的而減少? (poster 主動消失的需要減少)? */ Firstlogin types.NanoTS `bson:"first_login_nano_ts"` Lastlogin types.NanoTS `bson:"last_login_nano_ts"` /* 考慮透過 db-max, 但是可能在拉 user-detail 時會花很多時間. */ LastIP string `bson:"last_ip"` LastHost string `bson:"last_host"` // last-ip 的中文呈現, 外國則為國家. Money int `bson:"money"` PttEmail string `bson:"pttemail"` Justify string `bson:"justify"` Over18 bool `bson:"over18"` PagerUIType uint8 `bson:"pager_ui"` /* 呼叫器界面類別 (was: WATER_*) */ Pager ptttype.PagerMode `bson:"pager"` /* 呼叫器狀態 */ Invisible bool `bson:"hide"` Exmailbox uint32 `bson:"exmail"` Career string `bson:"career"` Role uint32 `bson:"role"` LastSeen types.NanoTS `bson:"last_seen_nano_ts"` TimeSetAngel types.NanoTS `bson:"time_set_angel_nano_ts"` TimePlayAngel types.NanoTS `bson:"time_play_angel_nano_ts"` LastSong types.NanoTS `bson:"last_song_nano_ts"` LoginView uint32 `bson:"login_view"` Vlcount int `bson:"violation"` FiveWin int `bson:"five_win"` FiveLose int `bson:"five_lose"` FiveTie int `bson:"five_tie"` ChcWin int `bson:"chc_win"` ChcLose int `bson:"chc_lose"` ChcTie int `bson:"chc_tie"` Conn6Win int `bson:"conn6_win"` Conn6Lose int `bson:"conn6_lose"` Conn6Tie int `bson:"conn6_tie"` GoWin int `bson:"go_win"` GoLose int `bson:"go_lose"` GoTie int `bson:"go_tie"` DarkWin int `bson:"dark_win"` DarkLose int `bson:"dark_lose"` DarkTie int `bson:"dark_tie"` /* 暗棋戰績 和 */ UaVersion uint8 `bson:"ua_version"` Signature uint8 `bson:"signaure"` /* 慣用簽名檔 */ BadPost int `bson:"bad_post"` /* 評價為壞文章數 */ MyAngel bbs.UUserID `bson:"angel"` /* 我的小天使 */ ChessEloRating int `bson:"chess_rank"` /* 象棋等級 */ TimeRemoveBadPost types.NanoTS `bson:"time_remove_bad_post_nano_ts"` TimeViolateLaw types.NanoTS `bson:"time_violate_law_nano_ts"` IsDeleted bool `bson:"deleted,omitempty"` UpdateNanoTS types.NanoTS `bson:"update_nano_ts"` UserLevel2 ptttype.PERM2 `bson:"perm2"` UpdateNanoTS2 types.NanoTS `bson:"update_nano_ts2"` }
func NewUserDetail ¶
func NewUserDetail(user_b pttbbsapi.GetUserResult, updateNanoTS types.NanoTS) (user *UserDetail)
type UserEmail ¶
type UserEmail struct { UserID bbs.UUserID `bson:"user_id"` Email string `bson:"email"` IsSet bool `bson:"is_set,omitempty"` UpdateNanoTS types.NanoTS `bson:"update_nano_ts"` }
func GetUserEmailByEmail ¶
type UserFavoriteID ¶
type UserFavorites ¶
type UserFavorites struct { UserID bbs.UUserID `bson:"user_id"` DoubleBufferIdx int `bson:"dbuffer_idx"` FavIdx int `bson:"fav_idx"` LevelIdx LevelIdx `bson:"level_idx"` Idx int `bson:"idx"` UpdateNanoTS types.NanoTS `bson:"update_nano_ts"` MTime types.NanoTS `bson:"mtime_nano_ts"` TheType pttbbsfav.FavT `bson:"the_type"` Attr pttbbsfav.Favh `bson:"attr"` TheID int `bson:"the_id"` // for folder FolderTitle string `bson:"folder_title"` FolderMeta *FolderMeta `bson:"folder_meta"` }
favorites is bounded by 1024 items. each item can be at most 100 bytes. We should be able to have all the favorites inside 1 document.
func GetAllUserFavorites ¶
func GetUserFavorites ¶
func SortUserFavoritesByFavIdx ¶
func SortUserFavoritesByFavIdx(userFavorites []*UserFavorites, ascending bool) (newUserFavorites []*UserFavorites)
type UserFavoritesMeta ¶
type UserFavoritesMeta struct { UserID bbs.UUserID `bson:"user_id"` DoubleBufferIdx int `bson:"db_idx"` UpdateNanoTS types.NanoTS `bson:"update_nano_ts"` MTime types.NanoTS `bson:"mtime_nano_ts"` FolderMeta FolderMeta `bson:"folder_meta"` }
func GetUserFavoritesMeta ¶
func GetUserFavoritesMeta(userID bbs.UUserID) (result *UserFavoritesMeta, err error)
type UserFavoritesMetaSummary ¶
type UserFavoritesMetaSummary struct { UserID bbs.UUserID `bson:"user_id"` DoubleBufferIdx int `bson:"db_idx"` MTime types.NanoTS `bson:"mtime_nano_ts"` }
func GetUserFavoritesMetaSummary ¶
func GetUserFavoritesMetaSummary(userID bbs.UUserID) (result *UserFavoritesMetaSummary, err error)
type UserFavoritesNanoTS ¶
type UserFavoritesQuery ¶
type UserFriend ¶
type UserIDEmail ¶
type UserIDEmail struct { UserID bbs.UUserID `bson:"user_id"` IDEmail string `bson:"idemail"` IsSet bool `bson:"is_set,omitempty"` UpdateNanoTS types.NanoTS `bson:"update_nano_ts"` }
func GetUserIDEmailByEmail ¶
func GetUserIDEmailByEmail(email string, updateNanoTS types.NanoTS) (userIDEmail *UserIDEmail, err error)
func GetUserIDEmailByUserID ¶
type UserInfoSummary ¶
type UserInfoSummary struct { UserID bbs.UUserID `bson:"user_id"` IsDeleted bool `bson:"deleted,omitempty"` UpdateNanoTS types.NanoTS `bson:"update_nano_ts"` }
func GetUserInfoSummary ¶
func GetUserInfoSummary(userID bbs.UUserID) (result *UserInfoSummary, err error)
type UserNewInfo ¶
type UserNewInfo struct { Avatar []byte `bson:"avatar"` AvatarNanoTS types.NanoTS `bson:"avatar_nano_ts"` IsDeleted bool `bson:"deleted,omitempty"` }
func GetUserNewInfo ¶
func GetUserNewInfo(userID bbs.UUserID) (result *UserNewInfo, err error)
type UserNickname ¶
type UserPermInfo ¶ added in v0.36.0
type UserPermInfo struct { UserID bbs.UUserID `bson:"user_id"` Userlevel ptttype.PERM `bson:"perm"` Over18 bool `bson:"over18"` Numlogindays int `bson:"login_days"` BadPost int `bson:"bad_post"` /* 評價為壞文章數 */ CooldownNanoTS types.NanoTS `bson:"cooldown_nano_ts"` Posttime int `bson:"postitme"` UpdateNanoTS types.NanoTS `bson:"update_nano_ts"` }
func GetUserPermInfo ¶ added in v0.36.0
func GetUserPermInfo(userID bbs.UUserID) (userPermInfo *UserPermInfo, err error)
type UserPosttime ¶ added in v0.36.0
type UserReadArticle ¶
type UserReadArticle struct { UserID bbs.UUserID `bson:"user_id"` BoardID bbs.BBoardID `bson:"bid"` ArticleID bbs.ArticleID `bson:"aid"` BoardArticleID types.BoardArticleID `bson:"baid"` ReadUpdateNanoTS types.NanoTS `bson:"update_nano_ts"` }
func FindUserReadArticles ¶
func FindUserReadArticlesByBoardArticleIDs ¶ added in v0.36.0
func FindUserReadArticlesByBoardArticleIDs(userID bbs.UUserID, boardArticleIDs []types.BoardArticleID) ([]*UserReadArticle, error)
type UserReadArticleQuery ¶
type UserReadBoard ¶
type UserReadBoard struct { UserID bbs.UUserID `bson:"user_id"` BBoardID bbs.BBoardID `bson:"bid"` ReadUpdateNanoTS types.NanoTS `bson:"update_nano_ts"` }
func FindUserReadBoards ¶
type UserReadBoardQuery ¶
type UserReject ¶
Source Files ¶
- 00-config.go
- access_token.go
- article.go
- article_comments.go
- article_content_info.go
- article_content_mtime.go
- article_delete.go
- article_detail_summary.go
- article_edit_summary.go
- article_first_comments.go
- article_n_comments.go
- article_perm_info.go
- article_rank.go
- article_summary.go
- article_summary_with_regex.go
- board.go
- board_banuser.go
- board_bid.go
- board_detail.go
- board_friend.go
- board_id.go
- board_perm_info.go
- board_summary.go
- client.go
- comment.go
- comment_dbcs.go
- comment_is_deleted.go
- comment_md5.go
- comment_sort_time.go
- comment_summary.go
- config.go
- config_util.go
- const.go
- content_block.go
- content_block_utils.go
- errors.go
- init.go
- lock.go
- man_article.go
- man_article_content_info.go
- man_article_content_mtime.go
- man_article_detail_summary.go
- man_article_summary.go
- man_content_block.go
- rank.go
- rank_delete.go
- testinit.go
- twofactor.go
- user.go
- user_aloha.go
- user_article.go
- user_board.go
- user_detail.go
- user_email.go
- user_favorite_id.go
- user_favorites.go
- user_favorites_meta.go
- user_favorites_meta_summary.go
- user_favorites_nano_ts.go
- user_friend.go
- user_id_email.go
- user_info_summary.go
- user_new_info.go
- user_nickname.go
- user_perm_info.go
- user_posttime.go
- user_read_article.go
- user_read_board.go
- user_reject.go
- user_visit.go
- user_visit_count.go
- utils.go