files

package
v0.0.0-...-e3263a0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: MIT Imports: 12 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, f *File) (id int64, err error)

func SetRoutes

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

func Update

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

Types

type File

type File struct {
	ID         int64     `json:"id"`
	FolderID   null.Int  `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 Get

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

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 (*File) Validate

func (f *File) Validate() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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