subject

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

Documentation

Index

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) Delete

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

func (*MongoMapper) FindOne

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

func (*MongoMapper) GetConn

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

func (*MongoMapper) Insert

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

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"`
}

Jump to

Keyboard shortcuts

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