comment

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2024 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const CollectionName = "comment"

Variables

This section is empty.

Functions

This section is empty.

Types

type Comment

type Comment struct {
	ID        primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"`
	UserId    string             `bson:"userId,omitempty" json:"userId,omitempty"`
	AtUserId  string             `bson:"atUserId,omitempty" json:"atUserId,omitempty"`
	SubjectId string             `bson:"subjectId,omitempty" json:"subjectId,omitempty"`
	RootId    string             `bson:"rootId,omitempty" json:"rootId,omitempty"`
	FatherId  string             `bson:"fatherId,omitempty" json:"fatherId,omitempty"`
	Content   string             `bson:"content,omitempty" json:"content,omitempty"`
	Meta      string             `bson:"meta,omitempty" json:"meta,omitempty"`
	Tags      []string           `bson:"tags,omitempty" json:"tags,omitempty"`
	Count     *int64             `bson:"count,omitempty" json:"count,omitempty"`
	State     int64              `bson:"state,omitempty" json:"state,omitempty"`
	Attrs     int64              `bson:"attrs,omitempty" json:"attrs,omitempty"`
	CreateAt  time.Time          `bson:"createAt,omitempty" json:"createAt,omitempty"`
	SortTime  int64              `bson:"sortTime,omitempty" json:"sortTime,omitempty"`
	HeatValue float64            `bson:"heatValue,omitempty" json:"heatValue,omitempty"`
}

type FilterOptions

type FilterOptions struct {
	OnlyUserId    *string
	OnlyAtUserId  *string
	OnlyCommentId *string
	OnlySubjectId *string
	OnlyRootId    *string
	OnlyFatherId  *string
	OnlyState     *int64
	OnlyAttrs     *int64
}

type IMongoMapper

type IMongoMapper interface {
	Insert(ctx context.Context, data *Comment) (string, error)
	FindOne(ctx context.Context, id string) (*Comment, error)
	Update(ctx context.Context, data *Comment) (*mongo.UpdateResult, error)
	UpdateAfterCreateComment(ctx context.Context, data *Comment)
	Delete(ctx context.Context, id string) (int64, error)
	DeleteWithUserId(ctx context.Context, id, userId string) (int64, error)
	Count(ctx context.Context, filter *FilterOptions) (int64, error)
	FindMany(ctx context.Context, fopts *FilterOptions, popts *pagination.PaginationOptions, sorter mongop.MongoCursor) ([]*Comment, error)
	FindManyAndCount(ctx context.Context, fopts *FilterOptions, popts *pagination.PaginationOptions, sorter mongop.MongoCursor) ([]*Comment, int64, error)
	GetConn() *monc.Model
	StartClient() *mongo.Client
}

func NewMongoMapper

func NewMongoMapper(config *config.Config) IMongoMapper

type MongoIndexFilter

type MongoIndexFilter struct {
	bson.M
	*FilterOptions
}

func (*MongoIndexFilter) CheckOnlyAtUserId

func (f *MongoIndexFilter) CheckOnlyAtUserId()

func (*MongoIndexFilter) CheckOnlyAttrs

func (f *MongoIndexFilter) CheckOnlyAttrs()

func (*MongoIndexFilter) CheckOnlyCommentId

func (f *MongoIndexFilter) CheckOnlyCommentId()

func (*MongoIndexFilter) CheckOnlyFatherId

func (f *MongoIndexFilter) CheckOnlyFatherId()

func (*MongoIndexFilter) CheckOnlyRootId

func (f *MongoIndexFilter) CheckOnlyRootId()

func (*MongoIndexFilter) CheckOnlyState

func (f *MongoIndexFilter) CheckOnlyState()

func (*MongoIndexFilter) CheckOnlySubjectId

func (f *MongoIndexFilter) CheckOnlySubjectId()

func (*MongoIndexFilter) CheckOnlyUserId

func (f *MongoIndexFilter) CheckOnlyUserId()

type MongoMapper

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

func (*MongoMapper) Count

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

func (*MongoMapper) Delete

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

func (*MongoMapper) DeleteWithUserId

func (m *MongoMapper) DeleteWithUserId(ctx context.Context, id, userId string) (int64, error)

func (*MongoMapper) FindMany

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

func (*MongoMapper) FindManyAndCount

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

func (*MongoMapper) FindOne

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

func (*MongoMapper) GetConn

func (m *MongoMapper) GetConn() *monc.Model

func (*MongoMapper) Insert

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

func (*MongoMapper) StartClient

func (m *MongoMapper) StartClient() *mongo.Client

func (*MongoMapper) Update

func (m *MongoMapper) Update(ctx context.Context, data *Comment) (*mongo.UpdateResult, error)

func (*MongoMapper) UpdateAfterCreateComment

func (m *MongoMapper) UpdateAfterCreateComment(ctx context.Context, data *Comment)

Jump to

Keyboard shortcuts

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