Documentation
¶
Index ¶
- func AccessAllowed(user *models.User, node *models.Node, write bool) bool
- func Copy(ctx context.Context, src *models.Node, parent *models.Node, filename string, ...) ([]*models.Node, error)
- func CopyData(ctx context.Context, node *models.Node, sourceFile string, homeRoot string, ...) error
- func CopyFile(srcPath, dstPath string) error
- func Delete(ctx context.Context, node *models.Node, recursive bool, user *models.User, ...) ([]*models.Node, error)
- func DetectMimeType(filename string) (string, error)
- func IsDir(node *models.Node) bool
- func IsValidName(filename string) bool
- func MakeDir(ctx context.Context, parent *models.Node, filename string, user *models.User, ...) (*models.Node, error)
- func Move(ctx context.Context, node *models.Node, dest *models.Node, user *models.User, ...) error
- func NewFile(ctx context.Context, parent *models.Node, filename, mimeType string, ...) (*models.Node, error)
- func NodeByID(ctx context.Context, id int, db boil.ContextExecutor) (*models.Node, error)
- func NodeByIDopt(ctx context.Context, id int, db boil.ContextExecutor) (*models.Node, error)
- func NodeByPath(ctx context.Context, path string, root *models.Node, tx boil.ContextExecutor) (*models.Node, error)
- func NodeChildByName(ctx context.Context, name string, parentID int, tx boil.ContextExecutor) (*models.Node, error)
- func NodesAll(ctx context.Context, db boil.ContextExecutor) ([]*models.Node, error)
- func NodesByParentID(ctx context.Context, parentID int, db boil.ContextExecutor) ([]*models.Node, error)
- func PathFor(ctx context.Context, node *models.Node, tx boil.ContextExecutor) (string, error)
- func PhysPath(ctx context.Context, node *models.Node, homeRoot string, ...) (string, error)
- func Rename(ctx context.Context, node *models.Node, filename string, user *models.User, ...) error
- func ThumbPath(root string, id int, includeFile bool) string
- func UpdateFile(ctx context.Context, node *models.Node, mimeType string, size int64, ...) error
- type NodeWithProgress
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AccessAllowed ¶
Checks if the given user has access to the given node.
func CopyData ¶
func CopyData(ctx context.Context, node *models.Node, sourceFile string, homeRoot string, tx *sql.Tx) error
Copy data to a node from source file.
func Delete ¶
func Delete(ctx context.Context, node *models.Node, recursive bool, user *models.User, homeRoot, thumbRoot string, tx boil.ContextExecutor) ([]*models.Node, error)
Delete a filesystem node.
func DetectMimeType ¶
Returns the mime type of a file or a default type.
func IsValidName ¶
IsValidName returns true if the given filename is valid.
func MakeDir ¶
func MakeDir(ctx context.Context, parent *models.Node, filename string, user *models.User, homeRoot string, dontCreatePhys bool, tx boil.ContextExecutor) (*models.Node, error)
MakeDir creates a filesystem directory.
func Move ¶
func Move(ctx context.Context, node *models.Node, dest *models.Node, user *models.User, homeRoot string, tx *sql.Tx) error
Move a node src under the dest directory node.
func NodeByIDopt ¶
NodeByIDopt returns a node by ID or nil if not found.
func NodeByPath ¶
func NodeByPath(ctx context.Context, path string, root *models.Node, tx boil.ContextExecutor) (*models.Node, error)
NodeByPath parses a path and tries to find a node matching it. Returns nil, nil for not found error.
func NodeChildByName ¶
func NodeChildByName(ctx context.Context, name string, parentID int, tx boil.ContextExecutor) (*models.Node, error)
NodeChildByName returns a child with the given name in the parent node. Returns nil, nil for not found error.
func NodesByParentID ¶
func NodesByParentID(ctx context.Context, parentID int, db boil.ContextExecutor) ([]*models.Node, error)
NodesByParentID returns nodes with the given parent ID.
func PhysPath ¶
func PhysPath(ctx context.Context, node *models.Node, homeRoot string, tx boil.ContextExecutor) (string, error)
PhysPath returns full path for a node. It queries nodes recursive upwards until it finds a stored path or ends up at the root.
func Rename ¶
func Rename(ctx context.Context, node *models.Node, filename string, user *models.User, homeRoot string, tx *sql.Tx) error
Rename a filesystem node.
Types ¶
type NodeWithProgress ¶
type NodeWithProgress struct { models.Node `boil:",bind"` Progress null.Float32 `boil:"progress.progress" json:"progress"` Volume null.Float32 `boil:"progress.volume" json:"volume"` }
NodeWithProgress contains models.Node data and associated progress data..
func NodeWithProgressByID ¶
func NodeWithProgressByID(ctx context.Context, nodeID, userID int, db boil.ContextExecutor) (*NodeWithProgress, error)
NodeWithProgressByID returns a node with progress information.
func NodesWithProgressByParentID ¶
func NodesWithProgressByParentID(ctx context.Context, parentID, userID int, db boil.ContextExecutor) ([]*NodeWithProgress, error)
NodesWithProgressByParentID returns nodes with progress information.