folders

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: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNameRequired = errors.New("name is required")
)

Functions

func Delete

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

func Insert

func Insert(db *sql.DB, f *Folder) (id int64, err error)

func SetRoutes

func SetRoutes(r chi.Router, db *sql.DB)

func Update

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

Types

type Folder

type Folder struct {
	ID         int64     `json:"id"`
	ParentID   null.Int  `json:"parent_id"`
	Name       string    `json:"name"`
	CreatedAt  time.Time `json:"created_at"`
	ModifiedAt time.Time `json:"modified_at"`
	Deleted    bool      `json:"-"`
}

func GetFolder

func GetFolder(db *sql.DB, folderID int64) (*Folder, error)

func (*Folder) Validate

func (f *Folder) Validate() error

type FolderContent

type FolderContent struct {
	Folder  Folder           `json:"folder"`
	Content []FolderResource `json:"content"`
}

type FolderResource

type FolderResource struct {
	ID         int64     `json:"id"`
	Name       string    `json:"name"`
	Type       string    `json:"type"`
	CreatedAt  time.Time `json:"created_at"`
	ModifiedAt time.Time `json:"modified_at"`
}

func GetFolderContent

func GetFolderContent(db *sql.DB, folderID int64) ([]FolderResource, error)

func GetRootFolderContent

func GetRootFolderContent(db *sql.DB) ([]FolderResource, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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