yvbolt/loadedDatabase.go

37 lines
966 B
Go
Raw Normal View History

package main
import (
"errors"
"github.com/ying32/govcl/vcl"
)
var ErrNavNotExist error = errors.New("The selected item no longer exists")
2024-07-06 00:02:58 +00:00
var ErrNotSupported error = errors.New("Unsupported action for this database type")
2024-06-27 23:34:00 +00:00
type contextAction struct {
Name string
Callback func(ndata *navData) error
2024-06-27 23:34:00 +00:00
}
// loadedDatabase is a DB-agnostic interface for each loaded database.
type loadedDatabase interface {
DisplayName() string
DriverName() string
RootElement() *vcl.TTreeNode
RenderForNav(f *TMainForm, ndata *navData) error
2024-07-05 23:45:41 +00:00
ApplyChanges(f *TMainForm, ndata *navData) error
ExecQuery(query string, resultArea *vcl.TStringGrid) error
NavChildren(ndata *navData) ([]string, error)
2024-06-27 23:34:00 +00:00
NavContext(ndata *navData) ([]contextAction, error)
Keepalive(ndata *navData)
Close()
}
// navData is the .Data() pointer for each TTreeNode in the left-hand tree.
type navData struct {
ld loadedDatabase
childrenLoaded bool
bucketPath []string
}