files

package
v0.0.0-...-25c177e Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrOwnerRequired = errors.New("owner is required")
	ErrNameRequired  = errors.New("name is required")
	ErrTypeRequired  = errors.New("type is required")
	ErrPathRequired  = errors.New("path is required")
)

Functions

func Delete

func Delete(db *sql.DB, id int64) error

func Insert

func Insert(db *sql.DB, file *File) (int64, error)

func SetRoutes

func SetRoutes(r chi.Router, db *sql.DB, b *bucket.Bucket, q *queue.Queue)

func Update

func Update(db *sql.DB, f *File, fileID int64) error

Types

type File

type File struct {
	ID         int64     `json:"id"`
	FolderID   int64     `json:"-"`
	OwnerID    int64     `json:"owner_id"`
	Name       string    `json:"name"`
	Type       string    `json:"type"`
	Path       string    `json:"-"`
	CreatedAt  time.Time `json:"created_at"`
	ModifiedAt time.Time `json:"modified_at"`
	Deleted    bool      `json:"-"`
}

func List

func List(db *sql.DB, folderID int64) ([]File, error)

func ListRoot

func ListRoot(db *sql.DB) ([]File, error)

func New

func New(ownerID int64, name, fileType, path string) (*File, error)

func Select

func Select(db *sql.DB, id int64) (*File, error)

func (*File) Validate

func (f *File) Validate() error

Jump to

Keyboard shortcuts

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