Code refactor #66
| @ -45,6 +45,12 @@ func main() { | ||||
| 
 | ||||
| 	menuStorageService := storage.MenuStorageService{} | ||||
| 
 | ||||
| 	err := menuStorageService.EnsureDbDir(dbDir) | ||||
| 	if err != nil { | ||||
| 		fmt.Fprintf(os.Stderr, err.Error()) | ||||
| 		os.Exit(1) | ||||
| 	} | ||||
| 
 | ||||
| 	rs, err := menuStorageService.GetResource(scriptDir, ctx) | ||||
| 	if err != nil { | ||||
| 		fmt.Fprintf(os.Stderr, err.Error()) | ||||
|  | ||||
| @ -31,10 +31,6 @@ type StorageService interface { | ||||
| type MenuStorageService struct{} | ||||
| 
 | ||||
| func (menuStorageService *MenuStorageService) GetPersister(dbDir string, ctx context.Context) (*persist.Persister, error) { | ||||
| 	err := ensureDbDir(dbDir) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	store := gdbmdb.NewGdbmDb() | ||||
| 	storeFile := path.Join(dbDir, "state.gdbm") | ||||
| 	store.Connect(ctx, storeFile) | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user