mirror of https://github.com/edouardparis/lntop
refac POC models
parent
7611eea6a0
commit
97c59ed809
@ -1,11 +1,33 @@
|
||||
package models
|
||||
|
||||
import "github.com/edouardparis/lntop/app"
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/edouardparis/lntop/app"
|
||||
"github.com/edouardparis/lntop/network/models"
|
||||
)
|
||||
|
||||
type Models struct {
|
||||
App *app.App
|
||||
App *app.App
|
||||
Info *Info
|
||||
}
|
||||
|
||||
func New(app *app.App) *Models {
|
||||
return &Models{App: app}
|
||||
return &Models{
|
||||
App: app,
|
||||
Info: &Info{},
|
||||
}
|
||||
}
|
||||
|
||||
func (m *Models) RefreshInfo(ctx context.Context) error {
|
||||
info, err := m.App.Network.Info(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*m.Info = Info{info}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Info struct {
|
||||
*models.Info
|
||||
}
|
||||
|
Loading…
Reference in New Issue