mirror of
https://codeberg.org/shroff/phylum.git
synced 2026-01-04 02:31:14 -06:00
19 lines
468 B
Go
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
|
|
}
|