Commit 8f77a3b
Changed files (1)
pkg
db
pkg/db/client.go
@@ -1,12 +1,22 @@
package db
+import (
+ "os"
+ "path/filepath"
+
+ "github.com/xlgmokha/x/pkg/x"
+)
+
type Storage[T any] struct {
dir string
}
func New[T any](dir string) *Storage[T] {
+ fullPath := x.Must(filepath.Abs(dir))
+ x.Check(os.MkdirAll(fullPath, 0700))
+
return &Storage[T]{
- dir: dir,
+ dir: fullPath,
}
}