33 Zeilen
610 B
Go
33 Zeilen
610 B
Go
package db
|
|
|
|
import (
|
|
"io/fs"
|
|
"os"
|
|
)
|
|
|
|
type iofsMigratorFS struct{ fsys fs.FS }
|
|
|
|
func (m iofsMigratorFS) ReadDir(dirname string) ([]fs.FileInfo, error) {
|
|
de, err := fs.ReadDir(m.fsys, dirname)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
var res []os.FileInfo
|
|
for _, v := range de {
|
|
fi, err := v.Info()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
res = append(res, fi)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
func (m iofsMigratorFS) ReadFile(filename string) ([]byte, error) {
|
|
return fs.ReadFile(m.fsys, filename)
|
|
}
|
|
|
|
func (m iofsMigratorFS) Glob(pattern string) (matches []string, err error) {
|
|
return fs.Glob(m.fsys, pattern)
|
|
}
|