dao

package
v0.0.0-...-61f55d0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Category4PostDraft

type Category4PostDraft struct {
	Id   string `bson:"id"`
	Name string `bson:"name"`
}

type IPostDraftDao

type IPostDraftDao interface {
	Save(ctx context.Context, postDraft *PostDraft) (string, error)
	GetById(ctx context.Context, id string) (*PostDraft, error)
	DeleteById(ctx context.Context, id string) (int64, error)
	QueryPage(ctx context.Context, cond bson.D, findOptions *options.FindOptions) ([]*PostDraft, int64, error)
}

type PostDraft

type PostDraft struct {
	ID               string               `bson:"_id"`
	CreatedAt        time.Time            `bson:"created_at,omitempty"`
	UpdatedAt        time.Time            `bson:"updated_at"`
	Author           string               `bson:"author"`
	Title            string               `bson:"title"`
	Summary          string               `bson:"summary"`
	Content          string               `bson:"content"`
	CoverImg         string               `bson:"cover_img"`
	Categories       []Category4PostDraft `bson:"categories"`
	Tags             []Tag4PostDraft      `bson:"tags"`
	IsDisplayed      bool                 `bson:"is_displayed"`
	StickyWeight     int                  `bson:"sticky_weight"`
	MetaDescription  string               `bson:"meta_description"`
	MetaKeywords     string               `bson:"meta_keywords"`
	WordCount        int                  `bson:"word_count"`
	IsCommentAllowed bool                 `bson:"is_comment_allowed"`
}

func (*PostDraft) DefaultCreatedAt

func (m *PostDraft) DefaultCreatedAt()

func (*PostDraft) DefaultId

func (m *PostDraft) DefaultId()

func (*PostDraft) DefaultUpdatedAt

func (m *PostDraft) DefaultUpdatedAt()

type PostDraftDao

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

func NewPostDraftDao

func NewPostDraftDao(db *mongo.Database) *PostDraftDao

func (*PostDraftDao) DeleteById

func (d *PostDraftDao) DeleteById(ctx context.Context, id string) (int64, error)

func (*PostDraftDao) GetById

func (d *PostDraftDao) GetById(ctx context.Context, id string) (*PostDraft, error)

func (*PostDraftDao) QueryPage

func (d *PostDraftDao) QueryPage(ctx context.Context, cond bson.D, findOptions *options.FindOptions) ([]*PostDraft, int64, error)

func (*PostDraftDao) Save

func (d *PostDraftDao) Save(ctx context.Context, postDraft *PostDraft) (string, error)

type Tag4PostDraft

type Tag4PostDraft struct {
	Id   string `bson:"id"`
	Name string `bson:"name"`
}

Jump to

Keyboard shortcuts

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