dao

package
v0.0.0-...-77539bd Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Category

type Category struct {
	Id          primitive.ObjectID `bson:"_id,omitempty"`
	Name        string             `bson:"name"`
	Route       string             `bson:"route"`
	Description string             `bson:"description"`
	Sort        int64              `bson:"sort"`
	Enabled     bool               `bson:"enabled"`
	ShowInNav   bool               `bson:"show_in_nav"`
	CreateTime  int64              `bson:"create_time"`
	UpdateTime  int64              `bson:"update_time"`
}

type CategoryDao

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

func NewCategoryDao

func NewCategoryDao(db *mongo.Database) *CategoryDao

func (*CategoryDao) Create

func (d *CategoryDao) Create(ctx context.Context, category *Category) (string, error)

func (*CategoryDao) DeleteById

func (d *CategoryDao) DeleteById(ctx context.Context, id primitive.ObjectID) error

func (*CategoryDao) GetAll

func (d *CategoryDao) GetAll(ctx context.Context) ([]*Category, error)

func (*CategoryDao) GetById

func (d *CategoryDao) GetById(ctx context.Context, id primitive.ObjectID) (*Category, error)

func (*CategoryDao) GetByRoute

func (d *CategoryDao) GetByRoute(ctx context.Context, route string) (*Category, error)

func (*CategoryDao) GetByShowInNav

func (d *CategoryDao) GetByShowInNav(ctx context.Context) ([]*Category, error)

func (*CategoryDao) GetEnabled

func (d *CategoryDao) GetEnabled(ctx context.Context) ([]*Category, error)

func (*CategoryDao) ModifyCategory

func (d *CategoryDao) ModifyCategory(ctx context.Context, id primitive.ObjectID, description string) error

func (*CategoryDao) ModifyCategoryNavigation

func (d *CategoryDao) ModifyCategoryNavigation(ctx context.Context, id primitive.ObjectID, showInNav bool) error

func (*CategoryDao) ModifyEnabled

func (d *CategoryDao) ModifyEnabled(ctx context.Context, id primitive.ObjectID, enabled bool) error

func (*CategoryDao) QuerySkipAndSetLimit

func (d *CategoryDao) QuerySkipAndSetLimit(ctx context.Context, cond bson.D, findOptions *options.FindOptions) ([]*Category, int64, error)

func (*CategoryDao) RecoverCategory

func (d *CategoryDao) RecoverCategory(ctx context.Context, category *Category) error

type ICategoryDao

type ICategoryDao interface {
	GetAll(ctx context.Context) ([]*Category, error)
	GetByRoute(ctx context.Context, route string) (*Category, error)
	QuerySkipAndSetLimit(ctx context.Context, cond bson.D, findOptions *options.FindOptions) ([]*Category, int64, error)
	Create(ctx context.Context, category *Category) (string, error)
	ModifyEnabled(ctx context.Context, id primitive.ObjectID, enabled bool) error
	ModifyCategory(ctx context.Context, id primitive.ObjectID, description string) error
	DeleteById(ctx context.Context, id primitive.ObjectID) error
	GetByShowInNav(ctx context.Context) ([]*Category, error)
	ModifyCategoryNavigation(ctx context.Context, id primitive.ObjectID, showInNav bool) error
	GetById(ctx context.Context, id primitive.ObjectID) (*Category, error)
	RecoverCategory(ctx context.Context, category *Category) error
	GetEnabled(ctx context.Context) ([]*Category, error)
}

Jump to

Keyboard shortcuts

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