42 lines
1008 B
Go
42 lines
1008 B
Go
package database
|
|
|
|
import (
|
|
"time"
|
|
|
|
"git.eeqj.de/sneak/feta/instance"
|
|
"github.com/google/uuid"
|
|
"github.com/jinzhu/gorm"
|
|
|
|
_ "github.com/jinzhu/gorm/dialects/sqlite"
|
|
)
|
|
|
|
// NB that when you add a model below you must add it to this list!
|
|
|
|
func (m *Manager) doMigrations() {
|
|
m.db.AutoMigrate(&apinstance{})
|
|
}
|
|
|
|
type apinstance struct {
|
|
gorm.Model
|
|
ID uuid.UUID `gorm:"type:uuid;primary_key;"`
|
|
ErrorCount uint
|
|
SuccessCount uint
|
|
HighestID int
|
|
Hostname string
|
|
Identified bool
|
|
Fetching bool
|
|
Disabled bool
|
|
Implementation string
|
|
NextFetch time.Time
|
|
NodeInfoURL string
|
|
ServerVersionString string
|
|
ServerImplementationString string
|
|
}
|
|
|
|
func (m *Manager) ListInstances() ([]*instance.Instance, error) {
|
|
output := make([]*instance.Instance, 0)
|
|
// FIXME have this produce a list of Instance
|
|
|
|
return output, nil
|
|
}
|