Documentation ¶
Index ¶
- Constants
- type IMongoMapper
- type MongoMapper
- func (m *MongoMapper) Delete(ctx context.Context, id, userId string) (int64, error)
- func (m *MongoMapper) FindOne(ctx context.Context, id string) (*Subject, error)
- func (m *MongoMapper) GetConn() *monc.Model
- func (m *MongoMapper) Insert(ctx context.Context, data *Subject) (string, error)
- func (m *MongoMapper) StartClient() *mongo.Client
- func (m *MongoMapper) Update(ctx context.Context, data *Subject) (*mongo.UpdateResult, error)
- func (m *MongoMapper) UpdateAfterCreateComment(ctx context.Context, data *Subject)
- type Subject
Constants ¶
View Source
const CollectionName = "subject"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IMongoMapper ¶
type IMongoMapper interface { Insert(ctx context.Context, data *Subject) (string, error) FindOne(ctx context.Context, id string) (*Subject, error) Update(ctx context.Context, data *Subject) (*mongo.UpdateResult, error) UpdateAfterCreateComment(ctx context.Context, data *Subject) Delete(ctx context.Context, id, userId string) (int64, error) GetConn() *monc.Model StartClient() *mongo.Client }
func NewMongoMapper ¶
func NewMongoMapper(config *config.Config) IMongoMapper
type MongoMapper ¶
type MongoMapper struct {
// contains filtered or unexported fields
}
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 *Subject) (*mongo.UpdateResult, error)
func (*MongoMapper) UpdateAfterCreateComment ¶
func (m *MongoMapper) UpdateAfterCreateComment(ctx context.Context, data *Subject)
type Subject ¶
type Subject struct { ID primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"` UserId string `bson:"userId,omitempty" json:"userId,omitempty"` TopCommentId *string `bson:"topCommentId,omitempty" json:"topCommentId,omitempty"` RootCount *int64 `bson:"rootCount,omitempty" json:"rootCount,omitempty"` AllCount *int64 `bson:"allCount,omitempty" json:"allCount,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"` UpdateAt time.Time `bson:"updateAt,omitempty" json:"updateAt,omitempty"` }
Click to show internal directories.
Click to hide internal directories.