schema

package
v0.36.3 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2024 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
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
)
View Source
const (
	N_USER_FAVORITES_DOUBLE_BUFFER = 2
)

Variables

View Source
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)
)
View Source
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")
)
View Source
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")
)
View Source
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")
)
View Source
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")
)
View Source
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")
)
View Source
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")
)
View Source
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")
)
View Source
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")
)
View Source
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")
)
View Source
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")
)
View Source
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")
)
View Source
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")
)
View Source
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")
)
View Source
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")
)
View Source
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")
)
View Source
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")
)
View Source
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")
)
View Source
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")
)
View Source
var (
	REDIS_USER_VISIT_COUNT     = "user_visit_count"
	REDIS_USER_VISIT_COUNT_EXP = 10 * time.Minute
)
View Source
var AccessToken_c *db.Collection
View Source
var Article_c *db.Collection
View Source
var BoardBanuser_c *db.Collection
View Source
var BoardFriend_c *db.Collection
View Source
var Board_c *db.Collection
View Source
var Client_c *db.Collection
View Source
var Comment_c *db.Collection
View Source
var ContentBlock_c *db.Collection
View Source
var (
	DEFAULT_POST_TYPE = []string{"問題", "建議", "討論", "心得", "閒聊", "請益", "情報", "公告"}
)
View Source
var EMPTY_ACCESS_TOKEN = &AccessToken{}
View Source
var EMPTY_ARTICLE = &Article{}
View Source
var (
	EMPTY_ARTICLE_COMMENTS = &ArticleComments{}
)
View Source
var (
	EMPTY_ARTICLE_CONTENT_INFO = &ArticleContentInfo{}
)
View Source
var EMPTY_ARTICLE_CONTENT_MTIME = &ArticleContentMTime{}
View Source
var EMPTY_ARTICLE_CREATE_QUERY = &ArticleCreateQuery{}
View Source
var (
	EMPTY_ARTICLE_DETAIL_SUMMARY = &ArticleDetailSummary{}
)
View Source
var (
	EMPTY_ARTICLE_FIRST_COMMENTS = &ArticleFirstComments{}
)
View Source
var (
	EMPTY_ARTICLE_N_COMMENTS = &ArticleNComments{}
)
View Source
var (
	EMPTY_ARTICLE_PERM_INFO = &ArticlePermInfo{}
)
View Source
var EMPTY_ARTICLE_QUERY = &ArticleQuery{}
View Source
var (
	EMPTY_ARTICLE_SUMMARY = &ArticleSummary{}
)
View Source
var (
	EMPTY_ARTICLE_SUMMARY_WITH_REGEX = &ArticleSummaryWithRegex{}
)
View Source
var EMPTY_BOARD = &Board{}
View Source
var (
	EMPTY_BOARD_BID = &BoardBid{}
)
View Source
var (
	EMPTY_BOARD_DETAIL = &BoardDetail{}
)
View Source
var (
	EMPTY_BOARD_ID = &BoardID{}
)
View Source
var (
	EMPTY_BOARD_PERM_INFO = &BoardPermInfo{}
)
View Source
var EMPTY_BOARD_QUERY = &BoardQuery{}
View Source
var (
	EMPTY_BOARD_SUMMARY = &BoardSummary{}
)
View Source
var EMPTY_CLIENT = &Client{}
View Source
var EMPTY_COMMENT = &Comment{}
View Source
var EMPTY_COMMENT_ARTICLE_QUERY = &CommentArticleQuery{}
View Source
var (
	EMPTY_COMMENT_DBCS = &CommentDBCS{}
)
View Source
var (
	EMPTY_COMMENT_IS_DELETED = &CommentIsDeleted{}
)
View Source
var (
	EMPTY_COMMENT_MD5 = &CommentMD5{}
)
View Source
var EMPTY_COMMENT_QUERY = &CommentQuery{}
View Source
var (
	EMPTY_COMMENT_SORT_TIME = &CommentSortTime{}
)
View Source
var (
	EMPTY_COMMENT_SUMMARY = &CommentSummary{}
)
View Source
var EMPTY_CONTENT_BLOCK = &ContentBlock{}
View Source
var EMPTY_CONTENT_BLOCK_QUERY = &ContentBlockQuery{}
View Source
var EMPTY_MAN_ARTICLE = &ManArticle{}
View Source
var (
	EMPTY_MAN_ARTICLE_CONTENT_INFO = &ManArticleContentInfo{}
)
View Source
var EMPTY_MAN_ARTICLE_CONTENT_MTIME = &ManArticleContentMTime{}
View Source
var (
	EMPTY_MAN_ARTICLE_DETAIL_SUMMARY = &ManArticleDetailSummary{}
)
View Source
var EMPTY_MAN_ARTICLE_QUERY = &ManArticleQuery{}
View Source
var (
	EMPTY_MAN_ARTICLE_SUMMARY = &ManArticleSummary{}
)
View Source
var EMPTY_RANK = &Rank{}
View Source
var EMPTY_USER = &User{}
View Source
var EMPTY_USER_ARTICLE = &UserArticle{}
View Source
var EMPTY_USER_BOARD = &UserBoard{}
View Source
var (
	EMPTY_USER_DETAIL = &UserDetail{}
)
View Source
var EMPTY_USER_EMAIL = &UserEmail{}
View Source
var EMPTY_USER_FAVORITES = &UserFavorites{}
View Source
var EMPTY_USER_FAVORITES_META = &UserFavoritesMeta{}
View Source
var (
	EMPTY_USER_FAVORITES_META_SUMMARY = &UserFavoritesMetaSummary{}
)
View Source
var EMPTY_USER_FAVORITES_NANO_TS = &UserFavoritesNanoTS{}
View Source
var EMPTY_USER_FAVORITES_QUERY = &UserFavoritesQuery{}
View Source
var EMPTY_USER_FAVORITE_ID = &UserFavoriteID{}
View Source
var EMPTY_USER_ID_EMAIL = &UserIDEmail{}
View Source
var (
	EMPTY_USER_INFO_SUMMARY = &UserInfoSummary{}
)
View Source
var (
	EMPTY_USER_NEW_INFO = &UserNewInfo{}
)
View Source
var (
	EMPTY_USER_NICKNAME = &UserNickname{}
)
View Source
var (
	EMPTY_USER_PERM_INFO = &UserPermInfo{}
)
View Source
var EMPTY_USER_POSTTIME = &UserPosttime{}
View Source
var EMPTY_USER_QUERY = &UserQuery{}
View Source
var EMPTY_USER_READ_ARTICLE = &UserReadArticle{}
View Source
var EMPTY_USER_READ_ARTICLE_QUERY = &UserReadArticleQuery{}
View Source
var EMPTY_USER_READ_BOARD = &UserReadBoard{}
View Source
var (
	EMPTY_USER_READ_BOARD_QUERY = &UserReadBoardQuery{}
)
View Source
var EMPTY_USER_VISIT = &UserVisit{}
View Source
var (
	IsTest = false
)
View Source
var ManArticle_c *db.Collection
View Source
var ManContentBlock_c *db.Collection
View Source
var Rank_c *db.Collection
View Source
var UserAloha_c *db.Collection
View Source
var UserArticle_c *db.Collection
View Source
var UserBoard_c *db.Collection
View Source
var UserEmail_c *db.Collection
View Source
var UserFavoritesMeta_c *db.Collection
View Source
var UserFavoritesNanoTS_c *db.Collection
View Source
var UserFavorites_c *db.Collection
View Source
var UserFriend_c *db.Collection
View Source
var UserIDEmail_c *db.Collection
View Source
var UserReject_c *db.Collection
View Source
var UserVisit_c *db.Collection
View Source
var User_c *db.Collection

Functions

func CalculateAllUserVisitCounts

func CalculateAllUserVisitCounts() (int64, error)

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 CountComments(boardID bbs.BBoardID, articleID bbs.ArticleID) (nComments int, err error)

func CreateUserEmail

func CreateUserEmail(userID bbs.UUserID, email string, updateNanoTS types.NanoTS) (err error)

func CreateUserIDEmail

func CreateUserIDEmail(userID bbs.UUserID, email string, updateNanoTS types.NanoTS) (err error)

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 FavToUserFavorites(f *fav.Fav, userID bbs.UUserID, doubleBufferIdx int, updateNanoTS types.NanoTS, mTime types.NanoTS) (meta *UserFavoritesMeta, userFavorites []*UserFavorites)

func Get2FA

func Get2FA(userID bbs.UUserID) (emailtoken string, err error)

func GetBoardID

func GetBoardID(brdname string) (boardID bbs.BBoardID, err error)

func GetBoardIDByBid

func GetBoardIDByBid(bid ptttype.Bid) (boardID bbs.BBoardID, err error)

func GetCommentMapByCommentIDs

func GetCommentMapByCommentIDs(boardID bbs.BBoardID, articleID bbs.ArticleID, commentIDs []types.CommentID) (commentMap map[types.CommentID]*Comment, err error)

func GetCommentSortTimeMapByCommentIDs

func GetCommentSortTimeMapByCommentIDs(boardID bbs.BBoardID, articleID bbs.ArticleID, commentIDs []types.CommentID) (sortTimeMap map[types.CommentID]types.NanoTS, err error)

func GetUserNickname

func GetUserNickname(userID bbs.UUserID) (nickname string, err error)

func GetUserVisitCount

func GetUserVisitCount() (total int64)

func Init

func Init() (err error)

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 RemoveManArticleSummaries

func RemoveManArticleSummaries(boardID bbs.BBoardID, levelIdx types.ManArticleID, idx int) (err error)

func ResetArticleIsBottom

func ResetArticleIsBottom(boardID bbs.BBoardID) (err error)

func Set2FA

func Set2FA(userID bbs.UUserID, email string, token string, expireTSDuration time.Duration) (err error)

func SetIsTest

func SetIsTest()

func SetUserVisitCount

func SetUserVisitCount(count int64) error

SetUserVisitCount try to set user visit count to redis

func SumRank

func SumRank(boardID bbs.BBoardID, articleID bbs.ArticleID) (total int, err error)

func TryLock

func TryLock(key string, expireTSDuration time.Duration) (err error)

TryLock

func TwoFactorSerializeValue

func TwoFactorSerializeValue(email string, token string) string

func Unlock

func Unlock(key string) (err error)

Unlock

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 UpdateArticleCommentsByArticleID

func UpdateArticleCommentsByArticleID(boardID bbs.BBoardID, articleID bbs.ArticleID, updateNanoTS types.NanoTS) (err error)

func UpdateArticleContentInfo

func UpdateArticleContentInfo(boardID bbs.BBoardID, articleID bbs.ArticleID, contentInfo *ArticleContentInfo) (err error)

func UpdateArticleContentMTime

func UpdateArticleContentMTime(bboardID bbs.BBoardID, articleID bbs.ArticleID, contentMTime types.NanoTS) (err error)

func UpdateArticleEditSummary

func UpdateArticleEditSummary(boardID bbs.BBoardID, articleID bbs.ArticleID, articleEditSummary *ArticleEditSummary, updateNanoTS types.NanoTS) (err error)

func UpdateArticleFirstComments

func UpdateArticleFirstComments(articleFirstComments *ArticleFirstComments) (err error)

func UpdateArticleRank

func UpdateArticleRank(boardID bbs.BBoardID, articleID bbs.ArticleID, diffRank int, updateNanoTS types.NanoTS) (newRank int, err error)

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 UpdateClient(c *Client) (err error)

func UpdateCommentSummaries

func UpdateCommentSummaries(bboardID bbs.BBoardID, articleID bbs.ArticleID, commentSummaries []*CommentSummary, updateNanoTS types.NanoTS) (err error)

func UpdateComments

func UpdateComments(comments []*Comment, updateNanoTS types.NanoTS) (err error)

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 UpdateManArticleContentMTime

func UpdateManArticleContentMTime(bboardID bbs.BBoardID, articleID types.ManArticleID, contentMTime types.NanoTS) (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 UpdateRank(boardID bbs.BBoardID, articleID bbs.ArticleID, ownerID bbs.UUserID, rank int, updateNanoTS types.NanoTS) (origRank int, err error)

func UpdateUserDetail

func UpdateUserDetail(user *UserDetail) (err error)

func UpdateUserEmailIsSet

func UpdateUserEmailIsSet(userID bbs.UUserID, email string, isSet bool, updateNanoTS types.NanoTS) (err error)

func UpdateUserFavorites

func UpdateUserFavorites(userID bbs.UUserID, doubleBufferIdx int, userFavorites []*UserFavorites, mTime types.NanoTS, updateNanoTS types.NanoTS) (err error)

func UpdateUserFavoritesMeta

func UpdateUserFavoritesMeta(meta *UserFavoritesMeta) (err error)

func UpdateUserIDEmailIsSet

func UpdateUserIDEmailIsSet(userID bbs.UUserID, email string, isSet bool, updateNanoTS types.NanoTS) (err error)

func UpdateUserPosttime added in v0.36.0

func UpdateUserPosttime(userID bbs.UUserID, postTime int) (err error)

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

func UpdateUserVisit(userVisit *UserVisit) (err error)

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

func NewAccessToken(userID bbs.UUserID, jwt string, nowNanoTS types.NanoTS) *AccessToken

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 ArticleComments struct {
	BBoardID  bbs.BBoardID  `bson:"bid"` //
	ArticleID bbs.ArticleID `bson:"aid"` //

	NComments int `bson:"n_comments"`

	CommentsUpdateNanoTS types.NanoTS `bson:"comments_update_nano_ts"`

	IsDeleted bool `bson:"deleted,omitempty"` //
}

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

func GetArticleContentInfo(bboardID bbs.BBoardID, articleID bbs.ArticleID, isContent bool) (contentInfo *ArticleContentInfo, err error)

type ArticleContentMTime

type ArticleContentMTime struct {
	ContentMTime types.NanoTS `bson:"content_mtime_nano_ts"`

	IsDeleted bool `bson:"deleted,omitempty"` //
}

ContentMTime

func GetArticleContentMTime

func GetArticleContentMTime(bboardID bbs.BBoardID, articleID bbs.ArticleID) (ret *ArticleContentMTime, err error)

type ArticleCreateQuery added in v0.36.0

type ArticleCreateQuery struct {
	BBoardID       bbs.BBoardID         `bson:"bid"`
	ArticleID      bbs.ArticleID        `bson:"aid"`
	BoardArticleID types.BoardArticleID `bson:"baid"`

	IsDeleted interface{} `bson:"deleted,omitempty"` //
}

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 GetArticleDetailSummaries

func GetArticleDetailSummaries(boardID bbs.BBoardID, startIdx string, descending bool, limit int, withDeleted bool) (result []*ArticleDetailSummary, err error)

func GetArticleDetailSummary

func GetArticleDetailSummary(bboardID bbs.BBoardID, articleID bbs.ArticleID) (result *ArticleDetailSummary, err error)

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

func NewArticleEditSummary(mTime types.NanoTS, titleRaw []byte, fullTitleRaw []byte, theClassRaw []byte, updateNanoTS types.NanoTS) *ArticleEditSummary

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 ArticleIsDeleted struct {
	IsDeleted    bool         `bson:"deleted,omitempty"`
	UpdateNanoTS types.NanoTS `bson:"update_nano_ts"`
}

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 GetArticlePermInfo(boardID bbs.BBoardID, articleID bbs.ArticleID) (articlePermInfo *ArticlePermInfo, err error)

func GetArticlesPermInfo added in v0.36.0

func GetArticlesPermInfo(boardID bbs.BBoardID, articleIDs []bbs.ArticleID) (articlesPermInfo []*ArticlePermInfo, err error)

type ArticleQuery

type ArticleQuery struct {
	BBoardID  bbs.BBoardID  `bson:"bid"`
	ArticleID bbs.ArticleID `bson:"aid"`
	IsDeleted interface{}   `bson:"deleted,omitempty"` //
}

type ArticleRank

type ArticleRank struct {
	BBoardID  bbs.BBoardID  `bson:"bid"` //
	ArticleID bbs.ArticleID `bson:"aid"` //

	Rank               int          `bson:"rank"` // 評價
	RankToUpdateNanoTS types.NanoTS `bson:"rank_to_update_nano_ts"`
	RankUpdateNanoTS   types.NanoTS `bson:"rank_update_nano_ts"`
}

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 GetArticleSummaries(boardID bbs.BBoardID, startIdx string, descending bool, limit int) (result []*ArticleSummary, err error)

func GetArticleSummariesByBoardArticleIDs added in v0.36.0

func GetArticleSummariesByBoardArticleIDs(boardArticleIDs []types.BoardArticleID) (result []*ArticleSummary, err error)

func GetArticleSummariesByOwnerID

func GetArticleSummariesByOwnerID(ownerID bbs.UUserID, startCreateTime types.NanoTS, descending bool, limit int) (result []*ArticleSummary, err error)

func GetArticleSummariesByRegex

func GetArticleSummariesByRegex(boardID bbs.BBoardID, keywordList []string, createNanoTS types.NanoTS, articleID bbs.ArticleID, descending bool, limit int) (result []*ArticleSummary, err error)

func GetArticleSummary

func GetArticleSummary(bboardID bbs.BBoardID, articleID bbs.ArticleID) (result *ArticleSummary, err error)

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 GetArticleSummaryWithRegex

func GetArticleSummaryWithRegex(bboardID bbs.BBoardID, articleID bbs.ArticleID) (result *ArticleSummaryWithRegex, err error)

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 BoardBanUser struct {
	BoardID   bbs.BBoardID `bson:"bid"`
	UserID    bbs.UUserID  `bson:"user_id"`
	EndNanoTS types.NanoTS `bson:"end_nano_ts"`
	PosterID  bbs.UUserID  `bson:"poster_id"`
	Reason    string       `bson:"reason"`

	UpdateNanoTS types.NanoTS `bson:"update_nano_ts"`
}

type BoardBid

type BoardBid struct {
	Bid ptttype.Bid `bson:"pttbid"`

	IdxByName  string `bson:"pttidxname"`
	IdxByClass string `bson:"pttidxclass"`
}

func GetBoardBidsByClsID

func GetBoardBidsByClsID(clsID ptttype.Bid, startIdx string, isAsc bool, limit int, sortBy ptttype.BSortBy) (boardBids []*BoardBid, err error)

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 GetBoardDetail(bboardID bbs.BBoardID, fields map[string]bool) (result *BoardDetail, err error)

func NewBoardDetail

func NewBoardDetail(b_b *bbs.BoardDetail, updateNanoTS types.NanoTS) *BoardDetail

type BoardFriend

type BoardFriend struct {
	BoardID bbs.BBoardID `bson:"bid"`
	UserID  bbs.UUserID  `bson:"user_id"`

	UpdateNanoTS types.NanoTS `bson:"update_nano_ts"`
}

type BoardID

type BoardID struct {
	BBoardID bbs.BBoardID `bson:"bid"`
	Brdname  string       `bson:"brdname"`
}

func GetBoardIDs

func GetBoardIDs(startBrdname string, descending bool, limit int, withDeleted bool) (result []*BoardID, err error)

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 BoardQuery struct {
	BBoardID bbs.BBoardID `bson:"bid"`

	IsDeleted interface{} `bson:"deleted,omitempty"`
}

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 GetBoardSummariesByClsID

func GetBoardSummariesByClsID(clsID ptttype.Bid, startIdx string, isAsc bool, limit int, sortBy ptttype.BSortBy) (boardSummaries []*BoardSummary, err error)

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 Client struct {
	ClientID     string           `bson:"client_id"`
	ClientSecret string           `bson:"client_secret"`
	ClientType   types.ClientType `bson:"client_type"`
	RemoteAddr   string           `bson:"ip"`
	UpdateNanoTS types.NanoTS     `bson:"update_nano_ts"`
}

func GetClient

func GetClient(clientID string) (ret *Client, err error)

func NewClient

func NewClient(clientID string, clientType types.ClientType, remoteAddr string) *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

func (c *Comment) SetSortTime(sortTime types.NanoTS)

type CommentArticleQuery

type CommentArticleQuery struct {
	BBoardID  bbs.BBoardID  `bson:"bid"`
	ArticleID bbs.ArticleID `bson:"aid"`
}

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

func GetAllCommentDBCSs(boardID bbs.BBoardID, articleID bbs.ArticleID) (commentDBCS []*CommentDBCS, err error)

type CommentIsDeleted

type CommentIsDeleted struct {
	IsDeleted    bool         `bson:"deleted,omitempty"`
	UpdateNanoTS types.NanoTS `bson:"update_nano_ts"`
}

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

func GetAllCommentMD5s(boardID bbs.BBoardID, articleID bbs.ArticleID) (commentMD5s []*CommentMD5, err error)

type CommentQuery

type CommentQuery struct {
	BBoardID  bbs.BBoardID    `bson:"bid"`
	ArticleID bbs.ArticleID   `bson:"aid"`
	CommentID types.CommentID `bson:"cid"`
}

type CommentSortTime

type CommentSortTime struct {
	CommentID types.CommentID `bson:"cid"`
	SortTime  types.NanoTS    `bson:"sort_time_nano_ts"`
}

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 GetBasicCommentSummariesByOwnerID

func GetBasicCommentSummariesByOwnerID(ownerID bbs.UUserID, startSortTime types.NanoTS, descending bool, limit int) (result []*CommentSummary, err error)

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 GetAllContentBlocks(boardID bbs.BBoardID, articleID bbs.ArticleID, contentID types.ContentID) (contentBlocks []*ContentBlock, err error)

func GetAllManContentBlocks

func GetAllManContentBlocks(boardID bbs.BBoardID, articleID types.ManArticleID, contentID types.ContentID) (contentBlocks []*ContentBlock, err error)

func GetContentBlock

func GetContentBlock(boardID bbs.BBoardID, articleID bbs.ArticleID, contentID types.ContentID, idx int) (contentBlock *ContentBlock, err error)

func GetContentBlocks

func GetContentBlocks(boardID bbs.BBoardID, articleID bbs.ArticleID, contentID types.ContentID, startIdx int, n int64) (contentBlocks []*ContentBlock, err error)

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 ContentBlockQuery struct {
	BBoardID  bbs.BBoardID    `bson:"bid"`
	ArticleID bbs.ArticleID   `bson:"aid"`
	ContentID types.ContentID `bson:"Cid"`
	Idx       int             `bson:"idx"`
}

type FolderMeta

type FolderMeta struct {
	FavNum   int `bson:"fav_num"`
	NBoards  int `bson:"n_boards"`
	NLines   int `bson:"n_lines"`
	NFolders int `bson:"n_folders"`
}

type LevelIdx

type LevelIdx string

func SetLevelIdx

func SetLevelIdx(prefix LevelIdx, idx int) LevelIdx

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 Rank

type Rank struct {
	BBoardID  bbs.BBoardID  `bson:"bid"`
	ArticleID bbs.ArticleID `bson:"aid"`
	Owner     bbs.UUserID   `bson:"owner"`

	Rank int `bson:"rank"`

	UpdateNanoTS types.NanoTS `bson:"update_nano_ts"`
}

type RankAgged

type RankAgged struct {
	BBoardID  bbs.BBoardID  `bson:"bid"`
	ArticleID bbs.ArticleID `bson:"aid"`

	Rank int `bson:"rank"`
}

func SumRankByBoardID

func SumRankByBoardID(boardID bbs.BBoardID, articleIDs []bbs.ArticleID) (ret []*RankAgged, err error)

type RankIsDeleted

type RankIsDeleted struct {
	IsDeleted    bool         `bson:"deleted,omitempty"`
	UpdateNanoTS types.NanoTS `bson:"update_nano_ts"`
}

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 UserAloha

type UserAloha struct {
	// 上站通知名單
	UserID  bbs.UUserID `bson:"user_id"`
	AlohaID bbs.UUserID `bson:"aloha_id"`

	UpdateNanoTS types.NanoTS `bson:"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

func FindUserArticles(userID bbs.UUserID, boardID bbs.BBoardID, articleIDs []bbs.ArticleID) ([]*UserArticle, error)

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

func FindUserBoard(userID bbs.UUserID, boardID bbs.BBoardID) (result *UserBoard, err error)

func FindUserBoards added in v0.36.0

func FindUserBoards(userID bbs.UUserID, boardIDs []bbs.BBoardID) (result []*UserBoard, err error)

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

func GetUserEmailByEmail(email string, updateNanoTS types.NanoTS) (userEmail *UserEmail, err error)

func GetUserEmailByUserID

func GetUserEmailByUserID(userID bbs.UUserID, updateNanoTS types.NanoTS) (userEmail *UserEmail, err error)

type UserFavoriteID

type UserFavoriteID struct {
	UserID          bbs.UUserID  `bson:"user_id"`
	DoubleBufferIdx int          `bson:"dbuffer_idx"`
	MTime           types.NanoTS `bson:"mtime_nano_ts"`

	LevelIdx LevelIdx `bson:"level_idx"`

	TheType pttbbsfav.FavT `bson:"the_type"`
	TheID   int            `bson:"the_id"`
}

func GetUserFavoriteIDsByPttbids

func GetUserFavoriteIDsByPttbids(userID bbs.UUserID, doubleBufferIdx int, pttbids []ptttype.Bid, mTime types.NanoTS) (userFavoriteIDs []*UserFavoriteID, err error)

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 GetAllUserFavorites(userID bbs.UUserID, doubleBufferIdx int, mTime types.NanoTS) (userFavorites []*UserFavorites, err error)

func GetUserFavorites

func GetUserFavorites(userID bbs.UUserID, doubleBufferIdx int, levelIdx LevelIdx, startIdx int, ascending bool, limit int, mTime types.NanoTS) (userFavorites []*UserFavorites, err error)

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 UserFavoritesNanoTS struct {
	UserID       bbs.UUserID  `bson:"user_id"`
	UpdateNanoTS types.NanoTS `bson:"update_nano_ts"`
}

type UserFavoritesQuery

type UserFavoritesQuery struct {
	UserID          bbs.UUserID `bson:"user_id"`
	DoubleBufferIdx int         `bson:"dbuffer_idx"`
	FavIdx          int         `bson:"fav_idx"`
}

type UserFriend

type UserFriend struct {
	UserID   bbs.UUserID `bson:"user_id"`
	FriendID bbs.UUserID `bson:"friend_id"`

	UpdateNanoTS types.NanoTS `bson:"update_nano_ts"`
}

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

func GetUserIDEmailByUserID(userID bbs.UUserID, updateNanoTS types.NanoTS) (userIDEmail *UserIDEmail, err error)

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 UserNickname struct {
	Username string `bson:"username"`
	Nickname string `bson:"nickname"`
}

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 UserPosttime struct {
	UserID               bbs.UUserID  `bson:"user_id"`
	Posttime             int          `bson:"postitme"`
	PosttimeUpdateNanoTS types.NanoTS `bson:"posttime_update_nano_ts"`
}

type UserQuery

type UserQuery struct {
	UserID    bbs.UUserID `bson:"user_id"`
	IsDeleted interface{} `bson:"deleted,omitempty"`
}

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 FindUserReadArticles(userID bbs.UUserID, boardID bbs.BBoardID, articleIDs []bbs.ArticleID) ([]*UserReadArticle, error)

func FindUserReadArticlesByBoardArticleIDs added in v0.36.0

func FindUserReadArticlesByBoardArticleIDs(userID bbs.UUserID, boardArticleIDs []types.BoardArticleID) ([]*UserReadArticle, error)

type UserReadArticleQuery

type UserReadArticleQuery struct {
	UserID    bbs.UUserID   `bson:"user_id"`
	BoardID   bbs.BBoardID  `bson:"bid"`
	ArticleID bbs.ArticleID `bson:"aid"`
}

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

func FindUserReadBoards(userID bbs.UUserID, boardIDs []bbs.BBoardID) ([]*UserReadBoard, error)

type UserReadBoardQuery

type UserReadBoardQuery struct {
	UserID   bbs.UUserID  `bson:"user_id"`
	BBoardID bbs.BBoardID `bson:"bid"`
}

type UserReject

type UserReject struct {
	UUserID  bbs.UUserID `bson:"user_id"`
	RejectID bbs.UUserID `bson:"reject_id"`

	UpdateNanoTS types.NanoTS `bson:"update_nano_ts"`
}

type UserVisit

type UserVisit struct {
	UserID       bbs.UUserID  `bson:"user_id"`
	Action       string       `bson:"action"`
	UpdateNanoTS types.NanoTS `bson:"update_nano_ts"`
}

Jump to

Keyboard shortcuts

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