core

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheService

type CacheService interface {
}

CacheService cache service interface that implement base Redis or other

type DataService

type DataService interface {
	WalletService
	SearchService
	StorageService

	GetComments(conditions *model.ConditionsT, offset, limit int) ([]*model.Comment, error)
	GetCommentByID(id int64) (*model.Comment, error)
	DeleteComment(comment *model.Comment) error
	GetCommentCount(conditions *model.ConditionsT) (int64, error)
	CreateComment(comment *model.Comment) (*model.Comment, error)
	CreateCommentReply(reply *model.CommentReply) (*model.CommentReply, error)
	GetCommentReplyByID(id int64) (*model.CommentReply, error)
	DeleteCommentReply(reply *model.CommentReply) error
	GetCommentContentsByIDs(ids []int64) ([]*model.CommentContent, error)
	GetCommentRepliesByID(ids []int64) ([]*model.CommentReplyFormated, error)
	CreateCommentContent(content *model.CommentContent) (*model.CommentContent, error)

	CreateMessage(msg *model.Message) (*model.Message, error)
	GetUnreadCount(userID int64) (int64, error)
	GetMessageByID(id int64) (*model.Message, error)
	ReadMessage(message *model.Message) error
	GetMessages(conditions *model.ConditionsT, offset, limit int) ([]*model.MessageFormated, error)
	GetMessageCount(conditions *model.ConditionsT) (int64, error)

	CreatePost(post *model.Post) (*model.Post, error)
	DeletePost(post *model.Post) error
	LockPost(post *model.Post) error
	StickPost(post *model.Post) error
	GetPostByID(id int64) (*model.Post, error)
	GetPosts(conditions *model.ConditionsT, offset, limit int) ([]*model.Post, error)
	GetPostCount(conditions *model.ConditionsT) (int64, error)
	UpdatePost(post *model.Post) error
	GetUserPostStar(postID, userID int64) (*model.PostStar, error)
	GetUserPostStars(userID int64, offset, limit int) ([]*model.PostStar, error)
	GetUserPostStarCount(userID int64) (int64, error)
	CreatePostStar(postID, userID int64) (*model.PostStar, error)
	DeletePostStar(p *model.PostStar) error
	GetUserPostCollection(postID, userID int64) (*model.PostCollection, error)
	GetUserPostCollections(userID int64, offset, limit int) ([]*model.PostCollection, error)
	GetUserPostCollectionCount(userID int64) (int64, error)
	GetUserWalletBills(userID int64, offset, limit int) ([]*model.WalletStatement, error)
	GetUserWalletBillCount(userID int64) (int64, error)
	CreatePostCollection(postID, userID int64) (*model.PostCollection, error)
	DeletePostCollection(p *model.PostCollection) error
	GetPostAttatchmentBill(postID, userID int64) (*model.PostAttachmentBill, error)
	CreatePostContent(content *model.PostContent) (*model.PostContent, error)
	GetPostContentsByIDs(ids []int64) ([]*model.PostContent, error)
	GetPostContentByID(id int64) (*model.PostContent, error)

	CreateTag(tag *model.Tag) (*model.Tag, error)
	DeleteTag(tag *model.Tag) error
	GetTags(conditions *model.ConditionsT, offset, limit int) ([]*model.Tag, error)

	GetUserByID(id int64) (*model.User, error)
	GetUserByUsername(username string) (*model.User, error)
	GetUserByPhone(phone string) (*model.User, error)
	GetUsersByIDs(ids []int64) ([]*model.User, error)
	GetUsersByKeyword(keyword string) ([]*model.User, error)
	GetTagsByKeyword(keyword string) ([]*model.Tag, error)
	CreateUser(user *model.User) (*model.User, error)
	UpdateUser(user *model.User) error
	GetLatestPhoneCaptcha(phone string) (*model.Captcha, error)
	UsePhoneCaptcha(captcha *model.Captcha) error
	SendPhoneCaptcha(phone string) error
}

DataService data service interface that process data related logic on database

type QueryT

type QueryT struct {
	Query string
	Type  SearchType
}

type SearchService

type SearchService interface {
	CreateSearchIndex(indexName string)
	BulkPushDoc(data []map[string]interface{}) (bool, error)
	DelDoc(indexName, id string) error
	QueryAll(q *QueryT, indexName string, offset, limit int) (*zinc.QueryResultT, error)
	QuerySearch(indexName, query string, offset, limit int) (*zinc.QueryResultT, error)
	QueryTagSearch(indexName, query string, offset, limit int) (*zinc.QueryResultT, error)
}

SearchService search service interface that implement base zinc

type SearchType

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

type StorageService

type StorageService interface {
	CreateAttachment(attachment *model.Attachment) (*model.Attachment, error)
}

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

type WalletService

type WalletService interface {
	GetRechargeByID(id int64) (*model.WalletRecharge, error)
	CreateRecharge(userId, amount int64) (*model.WalletRecharge, error)
	HandleRechargeSuccess(recharge *model.WalletRecharge, tradeNo string) error
	HandlePostAttachmentBought(post *model.Post, user *model.User) error
}

WalletService wallet service interface

Jump to

Keyboard shortcuts

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