mongo

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: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IdSort = internal.IdSorter
)

Variables

Functions

func MakeBsonFilter

func MakeBsonFilter(options *internal.FilterOptions) bson.M

Types

type PostFilter

type PostFilter struct {
	*internal.BaseFilter
	// contains filtered or unexported fields
}

func (*PostFilter) CheckFlags

func (f *PostFilter) CheckFlags()

func (*PostFilter) CheckOnlyUserId

func (f *PostFilter) CheckOnlyUserId()

type PostMongoModel

type PostMongoModel interface {
	Insert(ctx context.Context, data *internal.Post) error
	FindOne(ctx context.Context, id string) (*internal.Post, error)
	Update(ctx context.Context, data *internal.Post) error
	Delete(ctx context.Context, id string) error
	FindMany(ctx context.Context, fopts *internal.FilterOptions, popts *paginator.PaginationOptions, sorter int64) ([]*internal.Post, error)
	Count(ctx context.Context, fopts *internal.FilterOptions) (int64, error)
	FindManyAndCount(ctx context.Context, fopts *internal.FilterOptions, popts *paginator.PaginationOptions, sorter int64) ([]*internal.Post, int64, error)
	UpdateFlags(ctx context.Context, id string, flags map[internal.PostFlag]bool) error
}

PostMongoModel is an interface to be customized, add more methods here, and implement the added methods in defaultPostModel.

func NewPostModel

func NewPostModel(url, db string, c cache.CacheConf) PostMongoModel

NewPostModel returns a model for the mongo.

Jump to

Keyboard shortcuts

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