core

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 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 added in v0.2.0

type Action struct {
	Act    act
	UserId int64
}

type Attachment added in v0.2.0

type Attachment = dbr.Attachment

type AttachmentCheckService added in v0.1.2

type AttachmentCheckService interface {
	CheckAttachment(uri string) error
}

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

type Captcha = dbr.Captcha

type Comment added in v0.2.0

type Comment = dbr.Comment

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

type FriendFilter map[int64]types.Empty

func (FriendFilter) IsFriend added in v0.2.0

func (f FriendFilter) IsFriend(userId int64) bool

type FriendSet added in v0.2.0

type FriendSet map[string]types.Empty

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

type Message = dbr.Message

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

type Model = dbr.Model

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

type Post = dbr.Post

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

type PostStar = dbr.PostStar

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

type Tag = dbr.Tag

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

type TsDocItem struct {
	Post    *Post
	Content string
}

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

type User = dbr.User

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

Jump to

Keyboard shortcuts

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