-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: use bolt and file for defaults
- Loading branch information
1 parent
be13796
commit 661278b
Showing
7 changed files
with
78 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,30 @@ | ||
package config | ||
|
||
type Storage struct { | ||
Type string `json:"type" mapstructure:"type"` | ||
Memory StorageMemory `json:"memory" mapstructure:"memory"` | ||
Directory StorageDirectory `json:"directory" mapstructure:"directory"` | ||
Type StorageType `json:"type" mapstructure:"type"` | ||
Memory StorageMemory `json:"memory" mapstructure:"memory"` | ||
File StorageFile `json:"file" mapstructure:"file"` | ||
} | ||
|
||
func (s Storage) IsMemory() bool { | ||
return s.Type == "memory" | ||
type StorageType string | ||
|
||
const ( | ||
StorageTypeFile StorageType = "file" | ||
StorageTypeMemory StorageType = "memory" | ||
) | ||
|
||
func (s Storage) IsFile() bool { | ||
return s.Type == StorageTypeFile | ||
} | ||
|
||
func (s Storage) IsDirectory() bool { | ||
return s.Type == "directory" | ||
func (s Storage) IsMemory() bool { | ||
return s.Type == StorageTypeMemory | ||
} | ||
|
||
type StorageMemory struct { | ||
Size int64 `json:"size" mapstructure:"size"` | ||
} | ||
|
||
type StorageDirectory struct { | ||
type StorageFile struct { | ||
Path string `json:"-" mapstructure:"-"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters