removed unnecessary type
This commit is contained in:
parent
33811319e0
commit
1832d06382
@ -13,8 +13,7 @@ import (
|
||||
)
|
||||
|
||||
type Cluster map[string]Database
|
||||
type Database map[string]DatabaseValue
|
||||
type DatabaseValue interface{}
|
||||
type Database map[string]interface{}
|
||||
|
||||
var cluster Cluster = Cluster{}
|
||||
var locationOfCluster string = utils.GetPathToParrentFolderOfThisExecutable()
|
||||
@ -83,7 +82,7 @@ func GetDatabase(name string) (Database, error) {
|
||||
}
|
||||
|
||||
// GetKeyFromDatabase returns a key from a database if both exist
|
||||
func GetKeyFromDatabase(nameOfDatabase string, key string) (DatabaseValue, error) {
|
||||
func GetKeyFromDatabase(nameOfDatabase string, key string) (interface{}, error) {
|
||||
database, databaseExists := cluster[nameOfDatabase]
|
||||
if !databaseExists {
|
||||
return nil, errors.New("database does not exist")
|
||||
@ -219,7 +218,7 @@ func SetDatabase(name string, database Database) error {
|
||||
}
|
||||
|
||||
// SetKeyInDatabase sets a key from in a database and write it to file
|
||||
func SetKeyInDatabase(nameOfDatabase string, key string, value DatabaseValue) error {
|
||||
func SetKeyInDatabase(nameOfDatabase string, key string, value interface{}) error {
|
||||
err := ReloadDatabase(nameOfDatabase)
|
||||
if err != nil {
|
||||
return err
|
||||
|
Loading…
Reference in New Issue
Block a user