files

package
v0.0.0-...-0d233d1 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNameEmpty    = errors.New("name is required")
	ErrPathEmpty    = errors.New("path is required")
	ErrOwnerIDEmpty = errors.New("owner_id is required")
	ErrTypeEmpty    = errors.New("type is required")
)

Functions

func InsertDB

func InsertDB(db *sql.DB, file *File) (id int64, err error)

func SetRoutes

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

func SoftDeleteDB

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

func UpdateDB

func UpdateDB(db *sql.DB, id int64, file *File) (int64, 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"`
	UpdatedAt time.Time `json:"updated_at"`
	Deleted   bool      `json:"-"`
}

func New

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

func ReadAllDB

func ReadAllDB(db *sql.DB, folder_id int64) ([]File, error)

func ReadAllRootDB

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

func ReadDB

func ReadDB(db *sql.DB, id int64) (*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