Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BBSUserRecord ¶
type BBSUserRecord interface { bbs.UserRecord NumBadPosts() int LastCountry() string MailboxDescription() string ChessStatus() map[string]interface{} Plan() map[string]interface{} }
BBSUserRecord : currently interface `bbs.UserRecord` of go-bbs lacks some required methods, so we use a mock
type ForwardArticleToBoardRecord ¶ added in v0.0.2
type PopularArticleRecord ¶
type PopularArticleRecord interface { // Note: go-bbs has not implemented this yet // TODO: use bbs.PopularArticleRecord or something when it is ready bbs.ArticleRecord BoardID() string }
PopularArticleRecord is an ArticleRecord which has boardID information.
type PushRecord ¶ added in v0.0.2
type Repository ¶
type Repository interface { // board.go // GetBoards return all board record GetBoards(ctx context.Context) []bbs.BoardRecord // GetBoardArticle returns an article file in a specified board and filename GetBoardArticle(ctx context.Context, boardID, filename string) ([]byte, error) // GetBoardArticleRecords returns article records of a board GetBoardArticleRecords(ctx context.Context, boardID string) ([]bbs.ArticleRecord, error) // GetBoardTreasureRecords returns treasure article records of a board GetBoardTreasureRecords(ctx context.Context, boardID string, treasureIDs []string) ([]bbs.ArticleRecord, error) // user.go // GetUsers returns all user records GetUsers(ctx context.Context) ([]bbs.UserRecord, error) // GetUserFavoriteRecords returns favorite records of a user GetUserFavoriteRecords(ctx context.Context, userID string) ([]bbs.FavoriteRecord, error) // GetUserArticles returns user's articles GetUserArticles(ctx context.Context, boardID string) ([]bbs.ArticleRecord, error) // GetUserPreferences returns user's preferences // TODO: replace UserPreferencesRecord with real bbs record GetUserPreferences(ctx context.Context, userID string) (map[string]string, error) // GetUserComments return user's history comments // TODO: return a slice of concrete type not interface GetUserComments(ctx context.Context, userID string) ([]bbs.UserCommentRecord, error) // GetUserDrafts returns user's draft according to draftID GetUserDrafts(ctx context.Context, userID, draftID string) (bbs.UserDraft, error) // UpdateUserDraft updates user's draft according to draftID UpdateUserDraft(ctx context.Context, userID, draftID string, text []byte) (bbs.UserDraft, error) // DeleteUserDraft deletes user's draft according to draftID DeleteUserDraft(ctx context.Context, userID, draftID string) error // article.go // GetPopularArticles returns all popular articles GetPopularArticles(ctx context.Context) ([]PopularArticleRecord, error) // AppendComment returns comment details AppendComment(ctx context.Context, userID, boardID, filename, appendType, text string) (PushRecord, error) // CreateArticle // TODO: return result from bbs response CreateArticle(ctx context.Context, userID, boardID, title, article string) (bbs.ArticleRecord, error) // GetRawArticle GetRawArticle(boardID, filename string) (string, error) // ForwardArticleToBoard returns forwarding to board results ForwardArticleToBoard(ctx context.Context, userID, boardID, filename, boardName string) (ForwardArticleToBoardRecord, error) }
Repository directly interacts with database via db handler.
func NewRepository ¶
func NewRepository(db *bbs.DB) (Repository, error)
Click to show internal directories.
Click to hide internal directories.