pm

package
v0.33.11 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2023 License: AGPL-3.0, AGPL-3.0-only Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrPmDeleted = errors.New("private message deleted")
View Source
var ErrPmInvalidOperation = errors.New("invalid operation")
View Source
var ErrPmNotOwned = errors.New("not sent or received this private message")
View Source
var ErrPmRelatedNotExists = errors.New("related private message not exists")
View Source
var ErrPmUserIrrelevant = errors.New("has user irrelevant message")

Functions

This section is empty.

Types

type FolderType added in v0.30.3

type FolderType string
const (
	FolderTypeInbox  FolderType = "inbox"
	FolderTypeOutbox FolderType = "outbox"
)

type IDFilter added in v0.30.3

type IDFilter struct {
	Type null.Null[model.PrivateMessageID]
}

type PrivateMessage added in v0.30.3

type PrivateMessage struct {
	CreatedTime       time.Time
	Title             string
	Content           string
	Folder            FolderType
	SenderID          model.UserID
	ReceiverID        model.UserID
	ID                model.PrivateMessageID
	MainMessageID     model.PrivateMessageID // 如果当前是首条私信,则为当前私信的id,否则为0
	RelatedMessageID  model.PrivateMessageID // 首条私信的id
	New               bool
	DeletedBySender   bool
	DeletedByReceiver bool
}

type PrivateMessageListItem added in v0.30.3

type PrivateMessageListItem struct {
	Main PrivateMessage
	Self PrivateMessage
}

type PrivateMessageTypeCounts added in v0.30.3

type PrivateMessageTypeCounts struct {
	Unread int64
	Inbox  int64
	Outbox int64
}

type Repo added in v0.30.3

type Repo interface {
	List(
		ctx context.Context,
		userID model.UserID,
		folder FolderType,
		offset int,
		limit int,
	) ([]PrivateMessageListItem, error)

	CountByFolder(
		ctx context.Context,
		userID model.UserID,
		folder FolderType,
	) (int64, error)

	ListRelated(
		ctx context.Context,
		userID model.UserID,
		id model.PrivateMessageID,
	) ([]PrivateMessage, error)

	CountTypes(ctx context.Context, userID model.UserID) (PrivateMessageTypeCounts, error)

	MarkRead(ctx context.Context, userID model.UserID, relatedID model.PrivateMessageID) error

	ListRecentContact(ctx context.Context, userID model.UserID) ([]model.UserID, error)

	Create(
		ctx context.Context,
		senderID model.UserID,
		receiverIDs []model.UserID,
		relatedIDFilter IDFilter,
		title string,
		content string,
	) ([]PrivateMessage, error)

	Delete(
		ctx context.Context,
		userID model.UserID,
		ids []model.PrivateMessageID,
	) error
}

func NewMysqlRepo

func NewMysqlRepo(q *query.Query, log *zap.Logger) (Repo, error)

Jump to

Keyboard shortcuts

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