Work on database + tests

This commit is contained in:
Daniel 2018-09-11 18:59:27 +02:00
parent 06a34f931e
commit 4802982734
13 changed files with 395 additions and 150 deletions

32
database/database.go Normal file
View file

@ -0,0 +1,32 @@
package database
import (
"errors"
"time"
)
// Database holds information about registered databases
type Database struct {
Name string
Description string
StorageType string
PrimaryAPI string
Registered time.Time
LastUpdated time.Time
LastLoaded time.Time
}
// MigrateTo migrates the database to another storage type.
func (db *Database) MigrateTo(newStorageType string) error {
return errors.New("not implemented yet") // TODO
}
// Loaded updates the LastLoaded timestamp.
func (db *Database) Loaded() {
db.LastLoaded = time.Now().Round(time.Second)
}
// Updated updates the LastUpdated timestamp.
func (db *Database) Updated() {
db.LastUpdated = time.Now().Round(time.Second)
}