|
|
|
@ -11,40 +11,81 @@ import (
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
var (
|
|
|
|
|
_ core.IndexPostsService = (*indexPostsServant)(nil)
|
|
|
|
|
_ core.IndexPostsService = (*friendIndexServant)(nil)
|
|
|
|
|
_ core.IndexPostsService = (*followIndexServant)(nil)
|
|
|
|
|
_ core.IndexPostsService = (*lightIndexServant)(nil)
|
|
|
|
|
_ core.IndexPostsService = (*simpleIndexPostsServant)(nil)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type indexPostsServant struct {
|
|
|
|
|
type friendIndexServant struct {
|
|
|
|
|
*pgxServant
|
|
|
|
|
ams core.AuthorizationManageService
|
|
|
|
|
ths core.TweetHelpService
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type followIndexServant struct {
|
|
|
|
|
*pgxServant
|
|
|
|
|
ths core.TweetHelpService
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type lightIndexServant struct {
|
|
|
|
|
*pgxServant
|
|
|
|
|
ths core.TweetHelpService
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type simpleIndexPostsServant struct {
|
|
|
|
|
*pgxServant
|
|
|
|
|
ths core.TweetHelpService
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// IndexPosts 根据userId查询广场推文列表,简单做到不同用户的主页都是不同的;
|
|
|
|
|
func (s *friendIndexServant) IndexPosts(user *core.User, offset int, limit int) (*core.IndexTweetList, error) {
|
|
|
|
|
// TODO
|
|
|
|
|
return nil, debug.ErrNotImplemented
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// IndexPosts 根据userId查询广场推文列表,简单做到不同用户的主页都是不同的;
|
|
|
|
|
func (s *followIndexServant) IndexPosts(user *core.User, offset int, limit int) (*core.IndexTweetList, error) {
|
|
|
|
|
// TODO
|
|
|
|
|
return nil, debug.ErrNotImplemented
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// IndexPosts 根据userId查询广场推文列表,简单做到不同用户的主页都是不同的;
|
|
|
|
|
func (s *indexPostsServant) IndexPosts(user *core.User, offset int, limit int) (*core.IndexTweetList, error) {
|
|
|
|
|
func (s *lightIndexServant) IndexPosts(user *core.User, offset int, limit int) (*core.IndexTweetList, error) {
|
|
|
|
|
// TODO
|
|
|
|
|
debug.NotImplemented()
|
|
|
|
|
return nil, nil
|
|
|
|
|
return nil, debug.ErrNotImplemented
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// simpleCacheIndexGetPosts simpleCacheIndex 专属获取广场推文列表函数
|
|
|
|
|
func (s *simpleIndexPostsServant) IndexPosts(_user *core.User, offset int, limit int) (*core.IndexTweetList, error) {
|
|
|
|
|
// TODO
|
|
|
|
|
debug.NotImplemented()
|
|
|
|
|
return nil, nil
|
|
|
|
|
return nil, debug.ErrNotImplemented
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func newFriendIndexService(db *pgx.Conn, ams core.AuthorizationManageService, ths core.TweetHelpService) core.IndexPostsService {
|
|
|
|
|
return &friendIndexServant{
|
|
|
|
|
ams: ams,
|
|
|
|
|
pgxServant: newPgxServant(db),
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func newFollowIndexService(db *pgx.Conn, ths core.TweetHelpService) core.IndexPostsService {
|
|
|
|
|
return &followIndexServant{
|
|
|
|
|
ths: ths,
|
|
|
|
|
pgxServant: newPgxServant(db),
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func newIndexPostsService(db *pgx.Conn) core.IndexPostsService {
|
|
|
|
|
return &indexPostsServant{
|
|
|
|
|
func newLightIndexService(db *pgx.Conn, ths core.TweetHelpService) core.IndexPostsService {
|
|
|
|
|
return &lightIndexServant{
|
|
|
|
|
ths: ths,
|
|
|
|
|
pgxServant: newPgxServant(db),
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func newSimpleIndexPostsService(db *pgx.Conn) core.IndexPostsService {
|
|
|
|
|
func newSimpleIndexPostsService(db *pgx.Conn, ths core.TweetHelpService) core.IndexPostsService {
|
|
|
|
|
return &simpleIndexPostsServant{
|
|
|
|
|
ths: ths,
|
|
|
|
|
pgxServant: newPgxServant(db),
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|