Documentation ¶
Index ¶
- Constants
- type Action
- type Attachment
- type AttachmentCheckService
- type AttachmentType
- type AuthorizationManageService
- type CacheIndexService
- type Captcha
- type Comment
- type CommentContent
- type CommentFormated
- type CommentManageService
- type CommentReply
- type CommentReplyFormated
- type CommentService
- type ConditionsT
- type ContactItem
- type ContactList
- type ContactManageService
- type DataService
- type FriendFilter
- type FriendSet
- type IdxAct
- type IndexAction
- type IndexPostsService
- type IndexTweetList
- type Message
- type MessageFormated
- type MessageService
- type Model
- type ObjectStorageService
- type OssCreateService
- type OssDeleteService
- type PhoneVerifyService
- type Post
- type PostAttachmentBill
- type PostCollection
- type PostContent
- type PostContentFormated
- type PostContentT
- type PostFormated
- type PostStar
- type PostVisibleT
- type QueryReq
- type QueryResp
- type RedisCache
- type SearchType
- type SecurityService
- type Tag
- type TagFormated
- type TopicService
- type TsDocItem
- type TweetHelpService
- type TweetManageService
- type TweetSearchService
- type TweetService
- type User
- type UserFormated
- type UserManageService
- type VersionInfo
- type WalletRecharge
- type WalletService
- type WalletStatement
Constants ¶
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 )
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 )
const ( PostVisitPublic = dbr.PostVisitPublic PostVisitPrivate = dbr.PostVisitPrivate PostVisitFriend = dbr.PostVisitFriend PostVisitInvalid = dbr.PostVisitInvalid )
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 )
const ( UserStatusNormal = dbr.UserStatusNormal UserStatusClosed = dbr.UserStatusClosed )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Attachment ¶ added in v0.2.0
type Attachment = dbr.Attachment
type AttachmentCheckService ¶ added in v0.1.2
AttachmentCheckService 附件检测服务
type AttachmentType ¶ added in v0.2.0
type AttachmentType = dbr.AttachmentType
type AuthorizationManageService ¶ added in v0.2.0
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 ¶ added in v0.1.2
type CacheIndexService interface { IndexPostsService SendAction(act IdxAct, post *dbr.Post) }
CacheIndexService cache index service interface
type CommentContent ¶ added in v0.2.0
type CommentContent = dbr.CommentContent
type CommentFormated ¶ added in v0.2.0
type CommentFormated = dbr.CommentFormated
type CommentManageService ¶ added in v0.2.0
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 ¶ added in v0.2.0
type CommentReply = dbr.CommentReply
type CommentReplyFormated ¶ added in v0.2.0
type CommentReplyFormated = dbr.CommentReplyFormated
type CommentService ¶ added in v0.2.0
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 ¶ added in v0.2.0
type ConditionsT = dbr.ConditionsT
type ContactItem ¶ added in v0.2.0
type ContactList ¶ added in v0.2.0
type ContactList struct { Contacts []ContactItem `json:"contacts"` Total int64 `json:"total"` }
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) (*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 ¶ added in v0.2.0
func (FriendFilter) IsFriend ¶ added in v0.2.0
func (f FriendFilter) IsFriend(userId int64) bool
type IndexAction ¶ added in v0.2.0
func NewIndexAction ¶ added in v0.2.0
func NewIndexAction(act IdxAct, post *dbr.Post) *IndexAction
type IndexPostsService ¶ added in v0.1.2
type IndexPostsService interface {
IndexPosts(user *User, offset int, limit int) (*IndexTweetList, error)
}
IndexPostsService 广场首页推文列表服务
type IndexTweetList ¶ added in v0.2.0
type IndexTweetList struct { Tweets []*PostFormated Total int64 }
type MessageFormated ¶ added in v0.2.0
type MessageFormated = dbr.MessageFormated
type MessageService ¶ added in v0.2.0
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 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 PostAttachmentBill ¶ added in v0.2.0
type PostAttachmentBill = dbr.PostAttachmentBill
type PostCollection ¶ added in v0.2.0
type PostCollection = dbr.PostCollection
type PostContent ¶ added in v0.2.0
type PostContent = dbr.PostContent
type PostContentFormated ¶ added in v0.2.0
type PostContentFormated = dbr.PostContentFormated
type PostContentT ¶ added in v0.2.0
type PostContentT = dbr.PostContentT
type PostFormated ¶ added in v0.2.0
type PostFormated = dbr.PostFormated
type PostVisibleT ¶ added in v0.2.0
type PostVisibleT = dbr.PostVisibleT
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 []*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) (*Captcha, error) UsePhoneCaptcha(captcha *Captcha) error SendPhoneCaptcha(phone string) error }
SecurityService 安全相关服务
type TagFormated ¶ added in v0.2.0
type TagFormated = dbr.TagFormated
type TopicService ¶ added in v0.2.0
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 TweetHelpService ¶ added in v0.2.0
type TweetHelpService interface { RevampPosts(posts []*PostFormated) ([]*PostFormated, error) MergePosts(posts []*Post) ([]*PostFormated, error) }
TweetHelpService 推文辅助服务
type TweetManageService ¶ added in v0.2.0
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 ¶ added in v0.2.0
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 ¶ added in v0.2.0
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 UserFormated ¶ added in v0.2.0
type UserFormated = dbr.UserFormated
type UserManageService ¶ added in v0.2.0
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 ¶ added in v0.2.0
type VersionInfo interface { Name() string Version() *semver.Version }
VersionInfo 版本信息
type WalletRecharge ¶ added in v0.2.0
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 ¶ added in v0.2.0
type WalletStatement = dbr.WalletStatement