summaryrefslogtreecommitdiff
path: root/schema_selector.go
diff options
context:
space:
mode:
Diffstat (limited to 'schema_selector.go')
-rw-r--r--schema_selector.go29
1 files changed, 29 insertions, 0 deletions
diff --git a/schema_selector.go b/schema_selector.go
new file mode 100644
index 0000000..02ad07a
--- /dev/null
+++ b/schema_selector.go
@@ -0,0 +1,29 @@
+package main
+
+import (
+ "fmt"
+
+ "github.com/rivo/tview"
+
+ "bnbl.io/pgqt/postgres"
+)
+
+func newSchemaSelector(db *postgres.DB) *tview.List {
+ v := tview.NewList()
+ v.SetTitle("Schemata")
+ v.SetBorder(true)
+ v.ShowSecondaryText(false)
+ v.SetHighlightFullLine(true)
+
+ schemata, err := db.GetSchemata()
+ if err != nil {
+ v.AddItem(fmt.Sprintf("could not find schemata: %v", err), "", 'a', nil)
+ return v
+ }
+
+ for _, s := range schemata {
+ v.AddItem(s.SchemaName, "", 0, nil)
+ }
+
+ return v
+}