core

package
v0.0.0-...-8be1489 Latest Latest
Warning

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

Go to latest
Published: May 1, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ActRegisterUser act = iota
	ActCreatePublicTweet
	ActCreatePublicAttachment
	ActCreatePublicPicture
	ActCreatePublicVideo
	ActCreatePrivateTweet
	ActCreatePrivateAttachment
	ActCreatePrivatePicture
	ActCreatePrivateVideo
	ActCreateFriendTweet
	ActCreateFriendAttachment
	ActCreateFriendPicture
	ActCreateFriendVideo
	ActCreatePublicComment
	ActCreatePublicPicureComment
	ActCreateFriendComment
	ActCreateFriendPicureComment
	ActCreatePrivateComment
	ActCreatePrivatePicureComment
	ActStickTweet
	ActTopTweet
	ActLockTweet
	ActVisibleTweet
	ActDeleteTweet
	ActCreateActivationCode
)
View Source
const (
	MsgTypePost             = dbr.MsgTypePost
	MsgtypeComment          = dbr.MsgtypeComment
	MsgTypeReply            = dbr.MsgTypeReply
	MsgTypeWhisper          = dbr.MsgTypeWhisper
	MsgTypeRequestingFriend = dbr.MsgTypeRequestingFriend
	MsgTypeSystem           = dbr.MsgTypeSystem

	MsgStatusUnread = dbr.MsgStatusUnread
	MsgStatusReaded = dbr.MsgStatusReaded
)
View Source
const (
	PostVisitPublic  = dbr.PostVisitPublic
	PostVisitPrivate = dbr.PostVisitPrivate
	PostVisitFriend  = dbr.PostVisitFriend
	PostVisitInvalid = dbr.PostVisitInvalid
)
View Source
const (
	AttachmentTypeImage = dbr.AttachmentTypeImage
	AttachmentTypeVideo = dbr.AttachmentTypeVideo
	AttachmentTypeOther = dbr.AttachmentTypeOther

	// 类型,1标题,2文字段落,3图片地址,4视频地址,5语音地址,6链接地址,7附件资源
	ContentTypeTitle            = dbr.ContentTypeTitle
	ContentTypeText             = dbr.ContentTypeText
	ContentTypeImage            = dbr.ContentTypeImage
	ContentTypeVideo            = dbr.ContentTypeVideo
	ContentTypeAudio            = dbr.ContentTypeAudio
	ContentTypeLink             = dbr.ContentTypeLink
	ContentTypeAttachment       = dbr.ContentTypeAttachment
	ContentTypeChargeAttachment = dbr.ContentTypeChargeAttachment
)
View Source
const (
	UserStatusNormal = dbr.UserStatusNormal
	UserStatusClosed = dbr.UserStatusClosed
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	Act    act
	UserId int64
}

type Attachment

type Attachment = dbr.Attachment

type AttachmentCheckService

type AttachmentCheckService interface {
	CheckAttachment(uri string) error
}

AttachmentCheckService 附件检测服务

type AttachmentType

type AttachmentType = dbr.AttachmentType

type AuthorizationManageService

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

AuthorizationManageService 授权管理服务

type CacheIndexService

type CacheIndexService interface {
	IndexPostsService

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

CacheIndexService cache index service interface

type Captcha

type Captcha = dbr.Captcha

type Comment

type Comment = dbr.Comment

type CommentContent

type CommentContent = dbr.CommentContent

type CommentFormated

type CommentFormated = dbr.CommentFormated

type CommentManageService

type CommentManageService interface {
	DeleteComment(comment *Comment) error
	CreateComment(comment *Comment) (*Comment, error)
	CreateCommentReply(reply *CommentReply) (*CommentReply, error)
	DeleteCommentReply(reply *CommentReply) error
	CreateCommentContent(content *CommentContent) (*CommentContent, error)
}

CommentManageService 评论管理服务

type CommentReply

type CommentReply = dbr.CommentReply

type CommentReplyFormated

type CommentReplyFormated = dbr.CommentReplyFormated

type CommentService

type CommentService interface {
	GetComments(conditions *ConditionsT, offset, limit int) ([]*Comment, error)
	GetCommentByID(id int64) (*Comment, error)
	GetCommentCount(conditions *ConditionsT) (int64, error)
	GetCommentReplyByID(id int64) (*CommentReply, error)
	GetCommentContentsByIDs(ids []int64) ([]*CommentContent, error)
	GetCommentRepliesByID(ids []int64) ([]*CommentReplyFormated, error)
}

CommentService 评论检索服务

type ConditionsT

type ConditionsT = dbr.ConditionsT

type ContactItem

type ContactItem struct {
	UserId   int64  `json:"user_id"`
	UserName string `json:"username"`
	Nickname string `json:"nickname"`
	Avatar   string `json:"avatar"`
	Phone    string `json:"phone"`
}

type ContactList

type ContactList struct {
	Contacts []ContactItem `json:"contacts"`
	Total    int64         `json:"total"`
}

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) (*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

	// 安全服务
	SecurityService
	AttachmentCheckService
}

DataService 数据服务集成

type FriendFilter

type FriendFilter map[int64]types.Empty

func (FriendFilter) IsFriend

func (f FriendFilter) IsFriend(userId int64) bool

type FriendSet

type FriendSet map[string]types.Empty

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 *dbr.Post) *IndexAction

type IndexPostsService

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

IndexPostsService 广场首页推文列表服务

type IndexTweetList

type IndexTweetList struct {
	Tweets []*PostFormated
	Total  int64
}

type Message

type Message = dbr.Message

type MessageFormated

type MessageFormated = dbr.MessageFormated

type MessageService

type MessageService interface {
	CreateMessage(msg *Message) (*Message, error)
	GetUnreadCount(userID int64) (int64, error)
	GetMessageByID(id int64) (*Message, error)
	ReadMessage(message *Message) error
	GetMessages(conditions *ConditionsT, offset, limit int) ([]*MessageFormated, error)
	GetMessageCount(conditions *ConditionsT) (int64, error)
}

MessageService 消息服务

type Model

type Model = dbr.Model

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 Post

type Post = dbr.Post

type PostAttachmentBill

type PostAttachmentBill = dbr.PostAttachmentBill

type PostCollection

type PostCollection = dbr.PostCollection

type PostContent

type PostContent = dbr.PostContent

type PostContentFormated

type PostContentFormated = dbr.PostContentFormated

type PostContentT

type PostContentT = dbr.PostContentT

type PostFormated

type PostFormated = dbr.PostFormated

type PostStar

type PostStar = dbr.PostStar

type PostVisibleT

type PostVisibleT = dbr.PostVisibleT

type QueryReq

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

type QueryResp

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

type SearchType

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

type SecurityService

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

SecurityService 安全相关服务

type Tag

type Tag = dbr.Tag

type TagFormated

type TagFormated = dbr.TagFormated

type TopicService

type TopicService interface {
	CreateTag(tag *Tag) (*Tag, error)
	DeleteTag(tag *Tag) error
	GetTags(conditions *ConditionsT, offset, limit int) ([]*Tag, error)
	GetTagsByKeyword(keyword string) ([]*Tag, error)
}

TopicService 话题服务

type TsDocItem

type TsDocItem struct {
	Post    *Post
	Content string
}

type TweetHelpService

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

TweetHelpService 推文辅助服务

type TweetManageService

type TweetManageService interface {
	CreateAttachment(attachment *Attachment) (*Attachment, error)
	CreatePost(post *Post) (*Post, error)
	DeletePost(post *Post) ([]string, error)
	LockPost(post *Post) error
	StickPost(post *Post) error
	VisiblePost(post *Post, visibility PostVisibleT) error
	UpdatePost(post *Post) error
	CreatePostStar(postID, userID int64) (*PostStar, error)
	DeletePostStar(p *PostStar) error
	CreatePostCollection(postID, userID int64) (*PostCollection, error)
	DeletePostCollection(p *PostCollection) error
	CreatePostContent(content *PostContent) (*PostContent, error)
}

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

type TweetSearchService

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

TweetSearchService tweet search service interface

type TweetService

type TweetService interface {
	GetPostByID(id int64) (*Post, error)
	GetPosts(conditions *ConditionsT, offset, limit int) ([]*Post, error)
	GetPostCount(conditions *ConditionsT) (int64, error)
	GetUserPostStar(postID, userID int64) (*PostStar, error)
	GetUserPostStars(userID int64, offset, limit int) ([]*PostStar, error)
	GetUserPostStarCount(userID int64) (int64, error)
	GetUserPostCollection(postID, userID int64) (*PostCollection, error)
	GetUserPostCollections(userID int64, offset, limit int) ([]*PostCollection, error)
	GetUserPostCollectionCount(userID int64) (int64, error)
	GetPostAttatchmentBill(postID, userID int64) (*PostAttachmentBill, error)
	GetPostContentsByIDs(ids []int64) ([]*PostContent, error)
	GetPostContentByID(id int64) (*PostContent, error)
}

TweetService 推文检索服务

type User

type User = dbr.User

type UserFormated

type UserFormated = dbr.UserFormated

type UserManageService

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

UserManageService 用户管理服务

type VersionInfo

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

VersionInfo 版本信息

type WalletRecharge

type WalletRecharge = dbr.WalletRecharge

type WalletService

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

WalletService wallet service interface

type WalletStatement

type WalletStatement = dbr.WalletStatement

Jump to

Keyboard shortcuts

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