dataprovider

package
v0.0.0-...-04b4601 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2024 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const RootDirId = "11111111-1111-1111-1111-111111111111"

Variables

View Source
var (
	ErrExist         = os.ErrExist
	ErrNotExist      = os.ErrNotExist
	ErrPermission    = os.ErrPermission
	ErrInvalidParent = &os.PathError{Err: errors.New("parent does not exist or not a directory")}
)

Functions

func ChMTime

func ChMTime(path string, time time.Time) error

func CreateFileNodes

func CreateFileNodes(id string, nodes []*Node) error

func Delete

func Delete(id, parent string) error

func DeleteFileNodes

func DeleteFileNodes(id string) error

func Mkdir

func Mkdir(path string) error

func Mv

func Mv(name, newname string) error

func New

func New()

func Rm

func Rm(path string) error

func Touch

func Touch(path string) error

Types

type File

type File struct {
	ID     string        `json:"id"`
	Name   string        `json:"name" validate:"required,regex=^[A-Za-z0-9_][A-Za-z0-9_. -]*[A-Za-z0-9_]$"`
	Dir    bool          `json:"dir"`
	Size   int64         `json:"size,omitempty"`
	Parent ns.NullString `json:"parent,omitempty" validate:"required,uuid"`
	MTime  time.Time     `json:"mtime"`
}

func Create

func Create(name, parent string, isDir bool) (*File, error)

func Get

func Get(id, parent string) (*File, error)

func GetChild

func GetChild(id string) ([]*File, error)

func Ls

func Ls(path string, limit int, offset int) ([]*File, error)

func Stat

func Stat(path string) (*File, error)

func Update

func Update(id, parent string, file *File) (*File, error)

type Node

type Node struct {
	ID   int64 // snowflake id
	URL  string
	Size int
	Iv   string
}

func GetFileNodes

func GetFileNodes(id string) ([]*Node, error)

type PGProvider

type PGProvider struct {
	// contains filtered or unexported fields
}

type Provider

type Provider interface {
	// contains filtered or unexported methods
}

func NewPGProvider

func NewPGProvider(dbURL string) Provider

Directories

Path Synopsis
db

Jump to

Keyboard shortcuts

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