feta/database/dbmodel.go

42 lines
1008 B
Go
Raw Normal View History

2020-03-27 23:02:36 +00:00
package database
import (
"time"
2020-03-27 23:46:47 +00:00
"git.eeqj.de/sneak/feta/instance"
2020-03-27 23:02:36 +00:00
"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() {
2020-03-27 23:46:47 +00:00
m.db.AutoMigrate(&apinstance{})
2020-03-27 23:02:36 +00:00
}
2020-03-27 23:46:47 +00:00
type apinstance struct {
2020-03-27 23:02:36 +00:00
gorm.Model
2020-03-27 23:46:47 +00:00
ID uuid.UUID `gorm:"type:uuid;primary_key;"`
2020-03-27 23:02:36 +00:00
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
}
2020-03-27 23:46:47 +00:00
func (m *Manager) ListInstances() ([]*instance.Instance, error) {
output := make([]*instance.Instance, 0)
2020-03-27 23:02:36 +00:00
// FIXME have this produce a list of Instance
2020-03-27 23:46:47 +00:00
return output, nil
2020-03-27 23:02:36 +00:00
}