mirror of
https://github.com/safing/portbase
synced 2025-09-01 01:59:48 +00:00
32 lines
707 B
Go
32 lines
707 B
Go
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)
|
|
}
|