moment

package
v1.2.34 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2023 License: GPL-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const CollectionName = "moment"

Variables

This section is empty.

Functions

This section is empty.

Types

type EsFilter

type EsFilter struct {
	*FilterOptions
	// contains filtered or unexported fields
}

type EsMapper

type EsMapper struct {
	// contains filtered or unexported fields
}

func (*EsMapper) CountWithQuery

func (m *EsMapper) CountWithQuery(ctx context.Context, query []types.Query, fopts *FilterOptions) (int64, error)

func (*EsMapper) Search

func (m *EsMapper) Search(ctx context.Context, query []types.Query, fopts *FilterOptions, popts *pagination.PaginationOptions, sorter esp.EsCursor) ([]*Moment, int64, error)

type FilterOptions

type FilterOptions struct {
	OnlyUserId       *string
	OnlyCommunityId  *string
	OnlyCommunityIds []string
}

type IEsMapper

type IEsMapper interface {
	Search(ctx context.Context, query []types.Query, fopts *FilterOptions, popts *pagination.PaginationOptions, sorter esp.EsCursor) ([]*Moment, int64, error)
	CountWithQuery(ctx context.Context, query []types.Query, fopts *FilterOptions) (int64, error)
}

func NewEsMapper

func NewEsMapper(config *config.Config) IEsMapper

type IMongoMapper

type IMongoMapper interface {
	Insert(ctx context.Context, data *Moment) error
	FindOne(ctx context.Context, id string) (*Moment, error)
	Update(ctx context.Context, data *Moment) error
	Delete(ctx context.Context, id string) error
	FindMany(ctx context.Context, fopts *FilterOptions, popts *pagination.PaginationOptions, sorter mongop.MongoCursor) ([]*Moment, error)
	Count(ctx context.Context, filter *FilterOptions) (int64, error)
	FindManyAndCount(ctx context.Context, fopts *FilterOptions, popts *pagination.PaginationOptions, sorter mongop.MongoCursor) ([]*Moment, int64, error)
}

func NewMongoMapper

func NewMongoMapper(config *config.Config) IMongoMapper

type Moment

type Moment struct {
	ID          primitive.ObjectID `bson:"_id,omitempty" json:"_id,omitempty"`
	CatId       string             `bson:"catId,omitempty"`
	CommunityId string             `bson:"communityId,omitempty"`
	Photos      []string           `bson:"photos,omitempty"`
	Title       string             `bson:"title,omitempty"`
	Text        string             `bson:"text,omitempty"`
	UserId      string             `bson:"userId,omitempty"`
	UpdateAt    time.Time          `bson:"updateAt,omitempty" json:"updateAt,omitempty"`
	CreateAt    time.Time          `bson:"createAt,omitempty" json:"createAt,omitempty"`
	// 仅ES查询时使用
	Score_ float64 `bson:"_score,omitempty" json:"_score,omitempty"`
}

type MongoFilter

type MongoFilter struct {
	*FilterOptions
	// contains filtered or unexported fields
}

func (*MongoFilter) CheckOnlyCommunityId

func (f *MongoFilter) CheckOnlyCommunityId()

func (*MongoFilter) CheckOnlyCommunityIds

func (f *MongoFilter) CheckOnlyCommunityIds()

func (*MongoFilter) CheckOnlyUserId

func (f *MongoFilter) CheckOnlyUserId()

type MongoMapper

type MongoMapper struct {
	// contains filtered or unexported fields
}

func (*MongoMapper) Count

func (m *MongoMapper) Count(ctx context.Context, filter *FilterOptions) (int64, error)

func (*MongoMapper) Delete

func (m *MongoMapper) Delete(ctx context.Context, id string) error

func (*MongoMapper) FindMany

func (m *MongoMapper) FindMany(ctx context.Context, fopts *FilterOptions, popts *pagination.PaginationOptions, sorter mongop.MongoCursor) ([]*Moment, error)

func (*MongoMapper) FindManyAndCount

func (m *MongoMapper) FindManyAndCount(ctx context.Context, fopts *FilterOptions, popts *pagination.PaginationOptions, sorter mongop.MongoCursor) ([]*Moment, int64, error)

func (*MongoMapper) FindOne

func (m *MongoMapper) FindOne(ctx context.Context, id string) (*Moment, error)

func (*MongoMapper) Insert

func (m *MongoMapper) Insert(ctx context.Context, data *Moment) error

func (*MongoMapper) Update

func (m *MongoMapper) Update(ctx context.Context, data *Moment) error

Jump to

Keyboard shortcuts

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