category

package
v0.0.0-...-172aab7 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Count

func Count(filter bson.M) int

Count categories

Types

type Category

type Category struct {
	ID        primitive.ObjectID `bson:"_id" json:"id"`
	User      primitive.ObjectID `bson:"_user" json:"user"`
	Parent    primitive.ObjectID `bson:"_parent" json:"parent"`
	Name      string             `bson:"name" json:"name"`
	Thumbnail primitive.ObjectID `bson:"thumbnail" json:"thumbnail"`
	CreatedAt time.Time          `bson:"created_at" json:"created_at"`
}

Category Model

func Find

func Find(filter bson.M, page, limit int, sorts ...bson.E) []Category

Find categories

func FindOne

func FindOne(filter bson.M) (*Category, error)

FindOne category

func (*Category) Delete

func (c *Category) Delete() error

Delete a category

func (*Category) Insert

func (c *Category) Insert() error

Insert new Category

func (*Category) Save

func (c *Category) Save() error

Save a Category insert or update

func (*Category) Update

func (c *Category) Update() error

Update a Category

Jump to

Keyboard shortcuts

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