removed unnecessary type
This commit is contained in:
parent
33811319e0
commit
1832d06382
@ -13,8 +13,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Cluster map[string]Database
|
type Cluster map[string]Database
|
||||||
type Database map[string]DatabaseValue
|
type Database map[string]interface{}
|
||||||
type DatabaseValue interface{}
|
|
||||||
|
|
||||||
var cluster Cluster = Cluster{}
|
var cluster Cluster = Cluster{}
|
||||||
var locationOfCluster string = utils.GetPathToParrentFolderOfThisExecutable()
|
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
|
// 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]
|
database, databaseExists := cluster[nameOfDatabase]
|
||||||
if !databaseExists {
|
if !databaseExists {
|
||||||
return nil, errors.New("database does not exist")
|
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
|
// 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)
|
err := ReloadDatabase(nameOfDatabase)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user