Files
phylum/server/internal/core/mount.go
2025-07-14 16:45:13 +05:30

19 lines
468 B
Go

package core
import (
"errors"
"codeberg.org/shroff/phylum/server/internal/storage"
)
func (f FileSystem) CreateMount(path string, backend storage.Backend) error {
r, err := f.ResourceByPathWithRoot(path)
if err != nil {
return errors.New("unable to locate resource: " + err.Error())
}
const q = `INSERT INTO storage_mounts(id, storage) VALUES ($1, $2) ON CONFLICT(id) DO UPDATE SET storage = $2`
_, err = f.db.Exec(q, r.id, backend.Name())
return err
}