Documentation ¶
Index ¶
- Constants
- type Comment
- type FilterOptions
- type IMongoMapper
- type MongoIndexFilter
- func (f *MongoIndexFilter) CheckOnlyAtUserId()
- func (f *MongoIndexFilter) CheckOnlyAttrs()
- func (f *MongoIndexFilter) CheckOnlyCommentId()
- func (f *MongoIndexFilter) CheckOnlyFatherId()
- func (f *MongoIndexFilter) CheckOnlyRootId()
- func (f *MongoIndexFilter) CheckOnlyState()
- func (f *MongoIndexFilter) CheckOnlySubjectId()
- func (f *MongoIndexFilter) CheckOnlyUserId()
- type MongoMapper
- func (m *MongoMapper) Count(ctx context.Context, fopts *FilterOptions) (int64, error)
- func (m *MongoMapper) Delete(ctx context.Context, id string) (int64, error)
- func (m *MongoMapper) DeleteWithUserId(ctx context.Context, id, userId string) (int64, error)
- func (m *MongoMapper) FindMany(ctx context.Context, fopts *FilterOptions, popts *pagination.PaginationOptions, ...) ([]*Comment, error)
- func (m *MongoMapper) FindManyAndCount(ctx context.Context, fopts *FilterOptions, popts *pagination.PaginationOptions, ...) ([]*Comment, int64, error)
- func (m *MongoMapper) FindOne(ctx context.Context, id string) (*Comment, error)
- func (m *MongoMapper) GetConn() *monc.Model
- func (m *MongoMapper) Insert(ctx context.Context, data *Comment) (string, error)
- func (m *MongoMapper) StartClient() *mongo.Client
- func (m *MongoMapper) Update(ctx context.Context, data *Comment) (*mongo.UpdateResult, error)
- func (m *MongoMapper) UpdateAfterCreateComment(ctx context.Context, data *Comment)
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 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) DeleteWithUserId ¶
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) GetConn ¶
func (m *MongoMapper) GetConn() *monc.Model
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)
Click to show internal directories.
Click to hide internal directories.