dtviewers

package
v0.52.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 2, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const Title = "Viewers"

Title is the title of the Viewers module and of its list.

Variables

This section is empty.

Functions

func Module added in v0.51.4

func Module(viewers ...Viewer) datatugui.Module

Module returns the Viewers module of the main menu: a list of the given viewers whose selection pushes the viewer's page.

Types

type CollectionContext

type CollectionContext struct {
	DbContext
	CollectionRef dal.CollectionRef
}

CollectionContext is a collection of a database.

type DbContext

type DbContext interface {
	Name() string // A db name. For SQLite would be a file name
	Driver() Driver
	Schema() schemer.SchemaProvider
	GetDB(ctx context.Context) (db dal.DB, err error)
}

DbContext describes a database a viewer browses.

type DbContextBase

type DbContextBase struct {
	// contains filtered or unexported fields
}

DbContextBase is the DbContext implementation the concrete contexts embed.

func (*DbContextBase) Driver

func (c *DbContextBase) Driver() Driver

func (*DbContextBase) GetDB

func (c *DbContextBase) GetDB(ctx context.Context) (db dal.DB, err error)

func (*DbContextBase) Name

func (c *DbContextBase) Name() string

func (*DbContextBase) Schema

func (c *DbContextBase) Schema() schemer.SchemaProvider

type Driver

type Driver struct {
	ID         string
	ShortTitle string
}

Driver identifies a database driver.

type SqlDBContext

type SqlDBContext struct {
	DbContextBase
	GetSqlDB SqlDBGetter
}

SqlDBContext is a DbContext over database/sql.

func GetSQLiteDbContext

func GetSQLiteDbContext(path string) *SqlDBContext

GetSQLiteDbContext returns the DbContext of the SQLite file at path (a leading ~ is expanded).

func NewSqlDBContext

func NewSqlDBContext(driver Driver, name string, getSqlDB SqlDBGetter, schema schemer.SchemaProvider) *SqlDBContext

NewSqlDBContext creates a DbContext whose database is opened by getSqlDB.

type SqlDBGetter

type SqlDBGetter func(ctx context.Context, driverName string) (sqlDB *sql.DB, err error)

SqlDBGetter opens the SQL database for a driver name.

type Viewer

type Viewer struct {
	// ID identifies the viewer.
	ID ViewerID
	// Name is the label shown in the list.
	Name string
	// Description is shown muted under the name.
	Description string
	// Shortcut, when not zero, selects the viewer from the list.
	Shortcut rune
	// Root builds the page pushed when the viewer is chosen. An empty Title
	// defaults to Name. A page that needs its own menu sets Menu; otherwise the
	// main menu stays.
	Root func() nav.Page
}

Viewer is one entry of the Viewers screen: a way to browse data, such as a SQL database or a cloud account.

type ViewerID

type ViewerID string

ViewerID identifies a viewer; it is the second element of the persisted screen path, for example "viewers/sql".

Directories

Path Synopsis
Package clouds holds what the cloud viewers (Google Cloud, AWS, Azure) share.
Package clouds holds what the cloud viewers (Google Cloud, AWS, Azure) share.
aws/awsui
Package awsui is the Amazon Web Services viewer.
Package awsui is the Amazon Web Services viewer.
azure/azureui
Package azureui is the Microsoft Azure viewer.
Package azureui is the Microsoft Azure viewer.
gcloud/gcloudui
Package gcloudui is the Google Cloud viewer: projects, credentials and the Firestore databases of a project.
Package gcloudui is the Google Cloud viewer: projects, credentials and the Firestore databases of a project.
Package dbviewer is the DB viewer of the Viewers module: a chooser of database kinds, the SQLite and inGitDB home screens, and the browser of one database (tables and views, their columns, foreign keys, referrers and content).
Package dbviewer is the DB viewer of the Viewers module: a chooser of database kinds, the SQLite and inGitDB home screens, and the browser of one database (tables and views, their columns, foreign keys, referrers and content).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL