internal

package
v1.2.7 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2023 License: GPL-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ID       = "_id"
	Title    = "title"
	Text     = "text"
	CoverUrl = "coverUrl"
	Tags     = "tags"
	UserId   = "userId"
	Flags    = "flags"
	UpdateAt = "updateAt"
	CreateAt = "createAt"
)
View Source
const (
	IdSorter = iota
	ScoreSorter
)
View Source
const (
	OfficialFlag = 1 << 0
)
View Source
const PostCollectionName = "post"

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseFilter

type BaseFilter struct {
	MustFlags    *PostFlag
	MustNotFlags *PostFlag
	*FilterOptions
}

func (*BaseFilter) CheckOnlyOfficial

func (f *BaseFilter) CheckOnlyOfficial()

type Filter

type Filter interface {
	CheckOnlyOfficial()
	CheckFlags()
	CheckOnlyUserId()
}

type FilterOptions

type FilterOptions struct {
	OnlyUserId   *string
	OnlyOfficial *bool
}

type Post

type Post struct {
	ID       primitive.ObjectID `bson:"_id,omitempty" json:"_id,omitempty"`
	Title    string             `bson:"title,omitempty" `
	Text     string             `bson:"text,omitempty"`
	CoverUrl string             `bson:"coverUrl,omitempty"`
	Tags     []string           `bson:"tags,omitempty"`
	UserId   string             `bson:"userId,omitempty"`
	Flags    *PostFlag          `bson:"flags,omitempty"`
	UpdateAt time.Time          `bson:"updateAt,omitempty"`
	CreateAt time.Time          `bson:"createAt,omitempty"`
	// 仅ES查询时使用
	Score_ float64 `bson:"_score,omitempty" json:"_score,omitempty"`
}

type PostFlag

type PostFlag int64

func (*PostFlag) GetFlag

func (f *PostFlag) GetFlag(flag PostFlag) bool

func (*PostFlag) SetFlag

func (f *PostFlag) SetFlag(flag PostFlag, b bool) *PostFlag

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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