core

package
v0.0.0-...-85b3044 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PostVisitPublic    = dbr.PostVisitPublic
	PostVisitPrivate   = dbr.PostVisitPrivate
	PostVisitFriend    = dbr.PostVisitFriend
	PostVisitFollowing = dbr.PostVisitFollowing
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AppCache

type AppCache interface {
	Get(key string) ([]byte, error)
	Set(key string, data []byte, ex int64) error
	SetNx(key string, data []byte, ex int64) error
	Delete(key ...string) error
	DelAny(pattern string) error
	Exist(key string) bool
	Keys(pattern string) ([]string, error)
}

type AttachmentCheckService

type AttachmentCheckService interface {
	CheckAttachment(uri string) error
}

AttachmentCheckService 附件检测服务

type AuthorizationManageService

type AuthorizationManageService interface {
	IsAllow(user *ms.User, action *ms.Action) bool
	BeFriendFilter(userId int64) ms.FriendFilter
	BeFriendIds(userId int64) ([]int64, error)
	MyFriendSet(userId int64) ms.FriendSet
}

AuthorizationManageService 授权管理服务

type CacheIndexServantA

type CacheIndexServantA interface {
	SendAction(act IdxAct, tweet *cs.TweetInfo)
}

CacheIndexServantA cache index service interface

type CacheIndexService

type CacheIndexService interface {
	SendAction(act IdxAct, post *dbr.Post)
}

CacheIndexService cache index service interface

type CommentManageService

type CommentManageService interface {
	HighlightComment(userId, commentId int64) (int8, error)
	DeleteComment(comment *ms.Comment) error
	CreateComment(comment *ms.Comment) (*ms.Comment, error)
	CreateCommentReply(reply *ms.CommentReply) (*ms.CommentReply, error)
	DeleteCommentReply(reply *ms.CommentReply) error
	CreateCommentContent(content *ms.CommentContent) (*ms.CommentContent, error)
	ThumbsUpComment(userId int64, tweetId, commentId int64) error
	ThumbsDownComment(userId int64, tweetId, commentId int64) error
	ThumbsUpReply(userId int64, tweetId, commentId, replyId int64) error
	ThumbsDownReply(userId int64, tweetId, commentId, replyId int64) error
}

CommentManageService 评论管理服务

type CommentMetricServantA

type CommentMetricServantA interface {
	UpdateCommentMetric(metric *cs.CommentMetric) error
	AddCommentMetric(commentId int64) error
	DeleteCommentMetric(commentId int64) error
}

type CommentService

type CommentService interface {
	GetComments(tweetId int64, style cs.StyleCommentType, limit int, offset int) ([]*ms.Comment, int64, error)
	GetCommentByID(id int64) (*ms.Comment, error)
	GetCommentReplyByID(id int64) (*ms.CommentReply, error)
	GetCommentContentsByIDs(ids []int64) ([]*ms.CommentContent, error)
	GetCommentRepliesByID(ids []int64) ([]*ms.CommentReplyFormated, error)
	GetCommentThumbsMap(userId int64, tweetId int64) (cs.CommentThumbsMap, cs.CommentThumbsMap, error)
}

CommentService 评论检索服务

type CommunityManageService

type CommunityManageService interface {
	CreateCommunity(community *ms.Community) error
	RemoveCommunity(communityID uint) error
	AddMember(userID, communityID uint) error
	RemoveMember(userID, communityID uint) error
	JoinCommunity(userID, communityID uint) error
	LeaveCommunity(userID, communityID uint) error
}

type CommunityMetricServantA

type CommunityMetricServantA interface {
	UpdateCommunityMetric(metric *cs.CommunityMetric) error
	AddCommunityMetric(communityId int64) error
	DeleteCommunityMetric(communityId int64) error
}

Community Metrics?

type CommunityService

type CommunityService interface {
	GetCommunity(communityID uint) (*ms.Community, error)
	ListCommunities(offset, limit int) ([]*ms.Community, error)
	ListCommunityMembers(communityID uint, offset int, limit int) ([]*ms.User, error)
	GetCommunityPost(communityID uint, offset int, limit int) (*ms.IndexTweetList, error)
}

type ContactManageService

type ContactManageService interface {
	RequestingFriend(userId int64, friendId int64, greetings string) error
	AddFriend(userId int64, friendId int64) error
	RejectFriend(userId int64, friendId int64) error
	DeleteFriend(userId int64, friendId int64) error
	GetContacts(userId int64, offset int, limit int) (*ms.ContactList, error)
	IsFriend(userID int64, friendID int64) bool
}

ContactManageService 联系人管理服务

type DataService

DataService 数据服务集成

type FollowingManageService

type FollowingManageService interface {
	FollowUser(userId int64, followId int64) error
	UnfollowUser(userId int64, followId int64) error
	ListFollows(userId int64, limit, offset int) (*ms.ContactList, error)
	ListFollowings(userId int64, limit, offset int) (*ms.ContactList, error)
	GetFollowCount(userId int64) (int64, int64, error)
	IsFollow(userId int64, followId int64) bool
}

FollowingManageService 关注管理服务

type IdxAct

type IdxAct uint8
const (
	IdxActNop IdxAct = iota + 1
	IdxActCreatePost
	IdxActUpdatePost
	IdxActDeletePost
	IdxActStickPost
	IdxActVisiblePost
)

func (IdxAct) String

func (a IdxAct) String() string

type IndexAction

type IndexAction struct {
	Act  IdxAct
	Post *dbr.Post
}

func NewIndexAction

func NewIndexAction(act IdxAct, post *ms.Post) *IndexAction

type IndexActionA

type IndexActionA struct {
	Act   IdxAct
	Tweet *cs.TweetInfo
}

func NewIndexActionA

func NewIndexActionA(act IdxAct, tweet *cs.TweetInfo) *IndexActionA

type IndexPostsServantA

type IndexPostsServantA interface {
	IndexPosts(user *ms.User, limit int, offset int) (*cs.TweetBox, error)
}

IndexPostsServantA 广场首页推文列表服务(版本A)

type IndexPostsService

type IndexPostsService interface {
	IndexPosts(user *ms.User, offset int, limit int) (*ms.IndexTweetList, error)
}

IndexPostsService 广场首页推文列表服务

type MessageService

type MessageService interface {
	CreateMessage(msg *ms.Message) (*ms.Message, error)
	GetUnreadCount(userID int64) (int64, error)
	GetMessageByID(id int64) (*ms.Message, error)
	ReadMessage(message *ms.Message) error
	ReadAllMessage(userId int64) error
	GetMessages(userId int64, style cs.MessageStyle, limit, offset int) ([]*ms.MessageFormated, int64, error)
}

MessageService 消息服务

type ObjectStorageService

type ObjectStorageService interface {
	OssCreateService
	OssDeleteService

	SignURL(objectKey string, expiredInSec int64) (string, error)
	ObjectURL(objetKey string) string
	ObjectKey(cUrl string) string
}

ObjectStorageService storage service interface that implement base AliOSS、MINIO or other

type OssCreateService

type OssCreateService interface {
	PutObject(objectKey string, reader io.Reader, objectSize int64, contentType string, persistance bool) (string, error)
	PersistObject(objectKey string) error
}

OssCreateService Object Storage System Object Create service

type OssDeleteService

type OssDeleteService interface {
	DeleteObject(objectKey string) error
	DeleteObjects(objectKeys []string) error
	IsObjectExist(objectKey string) (bool, error)
}

OssCreateService Object Storage System Object Delete service

type PhoneVerifyService

type PhoneVerifyService interface {
	SendPhoneCaptcha(phone string, captcha string, expire time.Duration) error
}

PhoneVerifyService 手机验证服务

type PostVisibleT

type PostVisibleT = dbr.PostVisibleT

PostVisibleT 可访问类型,可见性: 0私密 10充电可见 20订阅可见 30保留 40保留 50好友可见 60关注可见 70保留 80保留 90公开

type QueryReq

type QueryReq struct {
	Query      string
	Visibility []PostVisibleT
	Type       SearchType
}

type QueryResp

type QueryResp struct {
	Items []*ms.PostFormated
	Total int64
}

type RedisCache

type RedisCache interface {
	SetPushToSearchJob(ctx context.Context) error
	DelPushToSearchJob(ctx context.Context) error
	SetImgCaptcha(ctx context.Context, id string, value string) error
	GetImgCaptcha(ctx context.Context, id string) (string, error)
	DelImgCaptcha(ctx context.Context, id string) error
	GetCountSmsCaptcha(ctx context.Context, phone string) (int64, error)
	IncrCountSmsCaptcha(ctx context.Context, phone string) error
	GetCountLoginErr(ctx context.Context, id int64) (int64, error)
	DelCountLoginErr(ctx context.Context, id int64) error
	IncrCountLoginErr(ctx context.Context, id int64) error
	GetCountWhisper(ctx context.Context, uid int64) (int64, error)
	IncrCountWhisper(ctx context.Context, uid int64) error
	SetRechargeStatus(ctx context.Context, tradeNo string) error
	DelRechargeStatus(ctx context.Context, tradeNo string) error
}

RedisCache memory cache by Redis

type ReportDAO

type ReportDAO interface {
	CreateReport(report *ms.Report) (int64, error)
	GetReportByID(id int64) (*ms.Report, error)
	UpdateReportStatus(id int64, status ms.Status) error
	DeleteReport(id int64) error
	ListReport(page, pageSize int) ([]ms.Report, error)
	ListReportByStatus(status string, page, pageSize int) ([]dbr.Report, int64, error)
}

type SearchType

type SearchType string
const (
	SearchTypeDefault SearchType = "search"
	SearchTypeTag     SearchType = "tag"
)

type SecurityService

type SecurityService interface {
	GetLatestPhoneCaptcha(phone string) (*ms.Captcha, error)
	UsePhoneCaptcha(captcha *ms.Captcha) error
	SendPhoneCaptcha(phone string) error
}

SecurityService 安全相关服务

type TopicServantA

type TopicServantA interface {
	UpsertTags(userId int64, tags []string) (cs.TagInfoList, error)
	DecrTagsById(ids []int64) error
	ListTags(typ cs.TagType, limit int, offset int) (cs.TagList, error)
	TagsByKeyword(keyword string) (cs.TagInfoList, error)
}

TopicServantA 话题服务(版本A)

type TopicService

type TopicService interface {
	UpsertTags(userId int64, tags []string) (cs.TagInfoList, error)
	DecrTagsById(ids []int64) error
	ListTags(typ cs.TagType, limit int, offset int) (cs.TagList, error)
	TagsByKeyword(keyword string) (cs.TagInfoList, error)
	GetHotTags(userId int64, limit int, offset int) (cs.TagList, error)
	GetNewestTags(userId int64, limit int, offset int) (cs.TagList, error)
	GetFollowTags(userId int64, limit int, offset int) (cs.TagList, error)
	FollowTopic(userId int64, topicId int64) error
	UnfollowTopic(userId int64, topicId int64) error
	StickTopic(userId int64, topicId int64) (int8, error)
}

TopicService 话题服务

type TrendsManageServantA

type TrendsManageServantA interface {
	GetIndexTrends(userId int64, limit int, offset int) ([]*cs.TrendsItem, int64, error)
}

TrendsManageServantA 动态信息管理服务

type TsDocItem

type TsDocItem struct {
	Post    *ms.Post
	Content string
}

type TweetHelpServantA

type TweetHelpServantA interface {
	RevampTweets(tweets cs.TweetList) (cs.TweetList, error)
	MergeTweets(tweets cs.TweetInfo) (cs.TweetList, error)
}

TweetHelpServantA 推文辅助服务(版本A)

type TweetHelpService

type TweetHelpService interface {
	RevampPosts(posts []*ms.PostFormated) ([]*ms.PostFormated, error)
	MergePosts(posts []*ms.Post) ([]*ms.PostFormated, error)
}

TweetHelpService 推文辅助服务

type TweetManageServantA

type TweetManageServantA interface {
	CreateAttachment(obj *cs.Attachment) (int64, error)
	CreateTweet(userId int64, req *cs.NewTweetReq) (*cs.TweetItem, error)
	DeleteTweet(userId int64, tweetId int64) ([]string, error)
	LockTweet(userId int64, tweetId int64) error
	StickTweet(userId int64, tweetId int64) error
	VisibleTweet(userId int64, visibility cs.TweetVisibleType) error
	CreateReaction(userId int64, tweetId int64) error
	DeleteReaction(userId int64, reactionId int64) error
	CreateFavorite(userId int64, tweetId int64) error
	DeleteFavorite(userId int64, favoriteId int64) error
}

TweetManageServantA 推文管理服务,包括创建/删除/更新推文(版本A)

type TweetManageService

type TweetManageService interface {
	CreatePost(post *ms.Post) (*ms.Post, error)
	DeletePost(post *ms.Post) ([]string, error)
	LockPost(post *ms.Post) error
	StickPost(post *ms.Post) error
	HighlightPost(userId, postId int64) (int, error)
	VisiblePost(post *ms.Post, visibility cs.TweetVisibleType) error
	UpdatePost(post *ms.Post) error
	CreatePostStar(postID, userID int64) (*ms.PostStar, error)
	DeletePostStar(p *ms.PostStar) error
	CreatePostCollection(postID, userID int64) (*ms.PostCollection, error)
	DeletePostCollection(p *ms.PostCollection) error
	CreatePostContent(content *ms.PostContent) (*ms.PostContent, error)
	CreateAttachment(obj *ms.Attachment) (int64, error)
}

TweetManageService 推文管理服务,包括创建/删除/更新推文

type TweetMetricServantA

type TweetMetricServantA interface {
	UpdateTweetMetric(metric *cs.TweetMetric) error
	AddTweetMetric(postId int64) error
	DeleteTweetMetric(postId int64) error
}

type TweetSearchService

type TweetSearchService interface {
	IndexName() string
	AddDocuments(data []TsDocItem, primaryKey ...string) (bool, error)
	DeleteDocuments(identifiers []string) error
	Search(user *ms.User, q *QueryReq, offset, limit int) (*QueryResp, error)
}

TweetSearchService tweet search service interface

type TweetServantA

type TweetServantA interface {
	TweetInfoById(id int64) (*cs.TweetInfo, error)
	TweetItemById(id int64) (*cs.TweetItem, error)
	UserTweets(visitorId, userId int64) (cs.TweetList, error)
	ReactionByTweetId(userId int64, tweetId int64) (*cs.ReactionItem, error)
	UserReactions(userId int64, limit int, offset int) (cs.ReactionList, error)
	FavoriteByTweetId(userId int64, tweetId int64) (*cs.FavoriteItem, error)
	UserFavorites(userId int64, limit int, offset int) (cs.FavoriteList, error)
	AttachmentByTweetId(userId int64, tweetId int64) (*cs.AttachmentBill, error)
}

TweetServantA 推文检索服务(版本A)

type TweetService

type TweetService interface {
	GetPostByID(id int64) (*ms.Post, error)
	GetPosts(conditions ms.ConditionsT, offset, limit int) ([]*ms.Post, error)
	GetPostCount(conditions ms.ConditionsT) (int64, error)
	GetUserPostStar(postID, userID int64) (*ms.PostStar, error)
	GetUserPostStars(userID int64, limit int, offset int) ([]*ms.PostStar, error)
	GetUserPostStarCount(userID int64) (int64, error)
	GetUserPostCollection(postID, userID int64) (*ms.PostCollection, error)
	GetUserPostCollections(userID int64, offset, limit int) ([]*ms.PostCollection, error)
	GetUserPostCollectionCount(userID int64) (int64, error)
	GetPostAttatchmentBill(postID, userID int64) (*ms.PostAttachmentBill, error)
	GetPostContentsByIDs(ids []int64) ([]*ms.PostContent, error)
	GetPostContentByID(id int64) (*ms.PostContent, error)
	ListUserStarTweets(user *cs.VistUser, limit int, offset int) ([]*ms.PostStar, int64, error)
	ListUserMediaTweets(user *cs.VistUser, limit int, offset int) ([]*ms.Post, int64, error)
	ListUserCommentTweets(user *cs.VistUser, limit int, offset int) ([]*ms.Post, int64, error)
	ListUserTweets(userId int64, style uint8, justEssence bool, limit, offset int) ([]*ms.Post, int64, error)
	ListFollowingTweets(userId int64, limit, offset int) ([]*ms.Post, int64, error)
	ListIndexNewestTweets(limit, offset int) ([]*ms.Post, int64, error)
	ListIndexHotsTweets(limit, offset int) ([]*ms.Post, int64, error)
	ListSyncSearchTweets(limit, offset int) ([]*ms.Post, int64, error)
}

TweetService 推文检索服务

type UserManageService

type UserManageService interface {
	GetUserByID(id int64) (*ms.User, error)
	GetUserByUsername(username string) (*ms.User, error)
	GetUserByPhone(phone string) (*ms.User, error)
	GetUsersByIDs(ids []int64) ([]*ms.User, error)
	GetUsersByKeyword(keyword string) ([]*ms.User, error)
	UserProfileByName(username string) (*cs.UserProfile, error)
	CreateUser(user *ms.User) (*ms.User, error)
	UpdateUser(user *ms.User) error
	GetRegisterUserCount() (int64, error)
}

UserManageService 用户管理服务

type UserMetricServantA

type UserMetricServantA interface {
	UpdateUserMetric(userId int64, action uint8) error
	AddUserMetric(userId int64) error
	DeleteUserMetric(userId int64) error
}

type UserRelationService

type UserRelationService interface {
	MyFriendIds(userId int64) ([]int64, error)
	MyFollowIds(userId int64) ([]int64, error)
	IsMyFriend(userId int64, friendIds ...int64) (map[int64]bool, error)
	IsMyFollow(userId int64, followIds ...int64) (map[int64]bool, error)
}

UserRelationService 用户关系服务

type VersionInfo

type VersionInfo interface {
	Name() string
	Version() *semver.Version
}

VersionInfo 版本信息

type WalletService

type WalletService interface {
	GetUserWalletBills(userID int64, offset, limit int) ([]*ms.WalletStatement, error)
	GetUserWalletBillCount(userID int64) (int64, error)
	GetRechargeByID(id int64) (*ms.WalletRecharge, error)
	CreateRecharge(userId, amount int64) (*ms.WalletRecharge, error)
	HandleRechargeSuccess(recharge *ms.WalletRecharge, tradeNo string) error
	HandlePostAttachmentBought(post *ms.Post, user *ms.User) error
}

WalletService wallet service interface

type WebCache

type WebCache interface {
	AppCache
	GetUnreadMsgCountResp(uid int64) ([]byte, error)
	PutUnreadMsgCountResp(uid int64, data []byte) error
	DelUnreadMsgCountResp(uid int64) error
	ExistUnreadMsgCountResp(uid int64) bool
	PutHistoryMaxOnline(newScore int) (int, error)
}

type WebDataServantA

type WebDataServantA interface {
	// 话题服务
	TopicServantA

	// 推文服务
	TweetServantA
	TweetManageServantA
	TweetHelpServantA
}

WebDataServantA Web数据服务集成(版本A)

Directories

Path Synopsis
Package ms contain core data service interface type model define for gorm adapter
Package ms contain core data service interface type model define for gorm adapter

Jump to

Keyboard shortcuts

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