removed unnecessary type

This commit is contained in:
Andreas Schulte 2023-10-23 23:36:22 +02:00
parent 33811319e0
commit 1832d06382
Signed by: andreas
GPG Key ID: DCD1B6A247B69DB6

View File

@ -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