mirror of
https://github.com/safing/portbase
synced 2026-05-01 21:21:23 +00:00
Work on database + tests
This commit is contained in:
parent
06a34f931e
commit
4802982734
13 changed files with 395 additions and 150 deletions
32
database/database.go
Normal file
32
database/database.go
Normal 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)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue