media

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: 19 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 medias

Types

type Media

type Media struct {
	ID        primitive.ObjectID `bson:"_id" json:"id"`
	User      primitive.ObjectID `bson:"_user" json:"user"`
	Name      string             `bson:"name" json:"name"`
	Paths     Path               `bson:"paths" json:"paths"`
	Type      string             `bson:"type" json:"type"`
	Size      int64              `bson:"size" json:"size"`
	CreatedAt time.Time          `bson:"created_at" json:"created_at"`
}

Media model

func Find

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

Find medias

func FindOne

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

FindOne media

func (*Media) Delete

func (m *Media) Delete() error

Delete a media

func (*Media) Insert

func (m *Media) Insert() error

Insert new Media

func (*Media) Save

func (m *Media) Save() error

Save a Media insert or update

func (*Media) Update

func (m *Media) Update() error

Update a Media

type Path

type Path struct {
	Original string `bson:"original" json:"original"`
	Large    string `bson:"large" json:"large"`
	Medium   string `bson:"medium" json:"medium"`
	Small    string `bson:"small" json:"small"`
}

Path model

func UploadFile

func UploadFile(file *multipart.FileHeader) (*Path, error)

UploadFile upload files

func (*Path) DeleteFile

func (p *Path) DeleteFile() error

DeleteFile remove file

Jump to

Keyboard shortcuts

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