core

package
v0.4.0-alpha.6 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

This section is empty.

Types

type AttachmentCheckService added in v0.1.2

type AttachmentCheckService interface {
	CheckAttachment(uri string) error
}

AttachmentCheckService 附件检测服务

type AuthorizationManageService added in v0.2.0

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 added in v0.4.0

type CacheIndexServantA interface {
	IndexPostsServantA

	SendAction(act IdxAct, tweet *cs.TweetInfo)
}

CacheIndexServantA cache index service interface

type CacheIndexService added in v0.1.2

type CacheIndexService interface {
	IndexPostsService

	SendAction(act IdxAct, post *dbr.Post)
}

CacheIndexService cache index service interface

type CommentManageService added in v0.2.0

type CommentManageService interface {
	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 CommentService added in v0.2.0

type CommentService interface {
	GetComments(conditions *ms.ConditionsT, offset, limit int) ([]*ms.Comment, error)
	GetCommentByID(id int64) (*ms.Comment, error)
	GetCommentCount(conditions *ms.ConditionsT) (int64, 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 ContactManageService added in v0.2.0

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

type DataService interface {
	// 钱包服务
	WalletService

	// 消息服务
	MessageService

	// 话题服务
	TopicService

	// 广场泡泡服务
	IndexPostsService

	// 推文服务
	TweetService
	TweetManageService
	TweetHelpService

	// 评论服务
	CommentService
	CommentManageService

	// 用户服务
	UserManageService
	ContactManageService
	FollowingManageService

	// 安全服务
	SecurityService
	AttachmentCheckService
}

DataService 数据服务集成

type FollowingManageService added in v0.4.0

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 added in v0.2.0

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

func (IdxAct) String added in v0.2.0

func (a IdxAct) String() string

type IndexAction added in v0.2.0

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

func NewIndexAction added in v0.2.0

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

type IndexActionA added in v0.4.0

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

func NewIndexActionA added in v0.4.0

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

type IndexPostsServantA added in v0.4.0

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

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

type IndexPostsService added in v0.1.2

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

IndexPostsService 广场首页推文列表服务

type MessageService added in v0.2.0

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
	GetMessages(conditions *ms.ConditionsT, offset, limit int) ([]*ms.MessageFormated, error)
	GetMessageCount(conditions *ms.ConditionsT) (int64, error)
}

MessageService 消息服务

type ObjectStorageService added in v0.1.2

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 added in v0.2.0

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 added in v0.2.0

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 added in v0.2.0

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

PhoneVerifyService 手机验证服务

type PostVisibleT added in v0.2.0

type PostVisibleT = dbr.PostVisibleT

PostVisibleT 可访问类型,0公开,1私密,2好友

type QueryReq added in v0.2.0

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

type QueryResp added in v0.2.0

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

type RedisCache added in v0.3.0

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 SearchType

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

type SecurityService added in v0.2.0

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

SecurityService 安全相关服务

type TopicServantA added in v0.4.0

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 added in v0.2.0

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 TsDocItem added in v0.2.0

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

type TweetHelpServantA added in v0.4.0

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

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

type TweetHelpService added in v0.2.0

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

TweetHelpService 推文辅助服务

type TweetManageServantA added in v0.4.0

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 added in v0.2.0

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 PostVisibleT) 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 TweetSearchService added in v0.2.0

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 added in v0.4.0

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 added in v0.2.0

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)
}

TweetService 推文检索服务

type UserManageService added in v0.2.0

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)
	CreateUser(user *ms.User) (*ms.User, error)
	UpdateUser(user *ms.User) error
}

UserManageService 用户管理服务

type VersionInfo added in v0.2.0

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 WebDataServantA added in v0.4.0

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