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 }