13 Commits

14 changed files with 158 additions and 49 deletions

View File

@@ -28,14 +28,14 @@ optimize-images:
yvbolt: $(SOURCES) yvbolt: $(SOURCES)
# Target a debian-12 baseline build # Target a debian-12 baseline build
sed -i -re 's/".+"/"$(GIT_REV)"/g' version.go sed -i -re 's/".+"/"$(GIT_REV)"/g' version.go
$(MIQT_DOCKER) linux64-go1.25-qt6.4-dynamic -minify-build $(MIQT_DOCKER) linux64-go1.26-qt6.4-dynamic -minify-build
git checkout -- version.go git checkout -- version.go
chmod 755 yvbolt chmod 755 yvbolt
upx --lzma yvbolt upx --lzma yvbolt
yvbolt.exe: $(SOURCES) yvbolt.exe: $(SOURCES)
sed -i -re 's/".+"/"$(GIT_REV)"/g' version.go sed -i -re 's/".+"/"$(GIT_REV)"/g' version.go
$(MIQT_DOCKER) win64-cross-go1.24-qt6.5-static -windows-build --tags=windowsqtstatic $(MIQT_DOCKER) win64-cross-go1.26-qt6.5-static -windows-build --tags=windowsqtstatic
git checkout -- version.go git checkout -- version.go
$(GO_WINRES) patch --in winres.json --no-backup --product-version git-tag --file-version git-tag yvbolt.exe $(GO_WINRES) patch --in winres.json --no-backup --product-version git-tag --file-version git-tag yvbolt.exe
upx --lzma yvbolt.exe upx --lzma yvbolt.exe
@@ -58,3 +58,10 @@ dist: yvbolt.linux64.tar.xz yvbolt.win64.zip
clean: clean:
git checkout -- version.go git checkout -- version.go
rm -f yvbolt.exe yvbolt yvbolt.linux64.tar.xz yvbolt.win64.zip rm -f yvbolt.exe yvbolt yvbolt.linux64.tar.xz yvbolt.win64.zip
#####
# Test databases in Docker
.PHONY: test-mongo
test-mongo:
sudo docker run --rm -p 127.0.0.1:27017:27017 -e MONGO_INITDB_ROOT_USERNAME=root -e MONGO_INITDB_ROOT_PASSWORD=toor mongo:latest

View File

@@ -48,6 +48,15 @@ The code in this project is licensed under the ISC license (see `LICENSE` file f
## Changelog ## Changelog
2025-12-17 v0.10.1
- Fix mixed Qt 5 / Qt 6 syntax
- Build release binaries with Go1.26
[⬇️ Download for Windows x86_64](https://git.ivysaur.me/code.ivysaur.me/yvbolt/releases/download/v0.10.1/yvbolt.win64.zip)
[⬇️ Download for Linux x86_64](https://git.ivysaur.me/code.ivysaur.me/yvbolt/releases/download/v0.10.1/yvbolt.linux64.tar.xz)
2025-12-16 v0.10.0 2025-12-16 v0.10.0
- MongoDB: Initial support, including SSH tunnel, managing collections, traversing BSON documents, and querying - MongoDB: Initial support, including SSH tunnel, managing collections, traversing BSON documents, and querying

37
TODO
View File

@@ -1,8 +1,9 @@
- BUG: Adding new entries to connection manager, then selecting them, opens wrong entry - BUG: Connecting to multiple DBs from connection manager: if one has an error, the error popup from the others is lost
- BUG: ExecQuery being called multiple times on error? - BUG: ExecQuery being called multiple times on error?
- Parity with QBolt, merge projects together - Parity with QBolt, merge projects together
- Portable mode (portable.txt or portable/ dir) - Portable mode (portable.txt or portable/ dir)
- Syntax highlighting in editor - Syntax highlighting in editor
- Autorefresh
- Table: BSON view can't see data - Table: BSON view can't see data
- Table: quick filter - Table: quick filter
- QSortFilterProxyModel - QSortFilterProxyModel
@@ -23,6 +24,7 @@
- MSSQL (recursive navigation for instances) - MSSQL (recursive navigation for instances)
- Other K/V stores from https://github.com/smallnest/kvbench - Other K/V stores from https://github.com/smallnest/kvbench
- Windows registry - Windows registry
- Allow entering path for quick navigation
- LDAP - LDAP
- Dolt - Dolt
- Memcache - Memcache
@@ -35,27 +37,36 @@
- Etcd - Etcd
- v2: hierarchal - v2: hierarchal
- v3: flat key namespace - v3: flat key namespace
- Tokyo Cabinet, Kyoto Cabinet, Tkrzw
- https://github.com/TerraTech/go-tokyocabinet needs pkg-config tokyocabinet
- https://github.com/estraier/tkrzw-go needs pkg-config tkrzw
- CSV file - CSV file
- Allow querying with sqlite or duckDB? - Allow querying with sqlite or duckDB?
- Parquet file - Parquet file
- Allow querying with duckDB? - Allow querying with duckDB?
- IRC client
- SSDB (Redis-compatible) - SSDB (Redis-compatible)
- Time-series DBs - Time-series DBs
- Prometheus - Prometheus
- VictoriaMetrics - VictoriaMetrics
- FrostDB https://github.com/polarsignals/frostdb - FrostDB https://github.com/polarsignals/frostdb
- https://dbdb.io/browse?programming=go-lang&q= - https://dbdb.io/browse?programming=go-lang&q=
- Stoolap https://github.com/stoolap/stoolap
- Rust, needs C binding layer https://github.com/mozilla/cbindgen
- Maxmind GeoIP MMDB format - Maxmind GeoIP MMDB format
- https://github.com/maxmind/mmdbwriter - https://github.com/maxmind/mmdbwriter
- Not-quite-DBs
- IRC client
- Docker daemon (images, containers, ...)
- ssh-agent - ssh-agent
- Connection dialog - ssh known-hosts
- SSH over Cockpit - golang.org/x/crypto/ssh/knownhosts - already using this package
- Generic ODBC, database/sql, ...
- Other language DBs
- C, C++
- Tokyo Cabinet, Kyoto Cabinet, Tkrzw
- https://github.com/TerraTech/go-tokyocabinet needs pkg-config tokyocabinet
- https://github.com/estraier/tkrzw-go needs pkg-config tkrzw
- cdb (DJB's Constant Database)
- Rust
- Stoolap https://github.com/stoolap/stoolap
- Rust, needs C binding layer https://github.com/mozilla/cbindgen
- JDBC Java databases
- H2, HSQLDB, Apache Derby
- SQLite CLI driver: - SQLite CLI driver:
- Context support - Context support
- Write support - Write support
@@ -69,6 +80,7 @@
- SQLite: - SQLite:
- drop table doesn't autorefresh nav since callback is late - drop table doesn't autorefresh nav since callback is late
- more accurate type handling - more accurate type handling
- binary data currently shows as "<<binary>>", edits wrongly
- views - views
- other special objects (triggers? udf functions?) - other special objects (triggers? udf functions?)
- remove current hardcoded LIMIT 1000 - remove current hardcoded LIMIT 1000
@@ -76,10 +88,12 @@
- MongoDB - MongoDB
- UI for replica sets, ssl certs, cluster, custom auth database - UI for replica sets, ssl certs, cluster, custom auth database
- SSH tunnel: error `ssh: tcpChan: deadline not supported` - needs workaround - SSH tunnel: error `ssh: tcpChan: deadline not supported` - needs workaround
- BSON type column with autoconfig based column editor
- Backup/restore - Backup/restore
- drop db/collection doesn't autorefresh nav since server is asynchronous - drop db/collection doesn't autorefresh nav since server is asynchronous
- SSH tunnel - option to use external/system SSH - SSH tunnel
- option to use external/system SSH
- SSH Agent support
- SSH over Cockpit
- Performance - Performance
- Warning if data table is filtered to 1000 rows, or add pagination - Warning if data table is filtered to 1000 rows, or add pagination
- Context/interrupt slow queries - Context/interrupt slow queries
@@ -91,4 +105,3 @@
- Export all data from grid - Export all data from grid
- Export all data from all buckets within a DB - Export all data from all buckets within a DB
- Reconnect - Reconnect
- Connecting to multiple DBs from connection manager: if one has an error, the error popup from the others is lost

View File

@@ -88,6 +88,12 @@ func (f *App) getConnectionManagerContents() (*SavedConfig, error) {
return nil, err return nil, err
} }
// Before returning the configuration, sort the entries alphabetically
sort.Slice(ret.Entries, func(i, j int) bool {
// FIXME there is probably a slightly more efficient way of doing this
return strings.ToLower(ret.Entries[i].Description) < strings.ToLower(ret.Entries[j].Description)
})
// Success // Success
return &ret, nil return &ret, nil
} }
@@ -153,15 +159,7 @@ func (f *App) saveConnectionManagerContents(sc *SavedConfig) error {
} }
// Force update the saved version // Force update the saved version
sc.UserAgent = APPNAME // TODO get app's own version sc.UserAgent = APPNAME + `/` + appVersion // e.g. yvbolt/v0.0.0-devel
// When saving, the version that gets saved always has descriptions sorted
// alphabetically.
// But, you won't know this until you reload the contents.
sort.Slice(sc.Entries, func(i, j int) bool {
// FIXME there is probably a slightly more efficient way of doing this
return strings.ToLower(sc.Entries[i].Description) < strings.ToLower(sc.Entries[j].Description)
})
// Marshal // Marshal

View File

@@ -178,9 +178,14 @@ func (ld *lmdbDatabase) createChildDatabase(sender *qt.QTreeWidgetItem, bucketPa
}) })
} }
//func (ld *lmdbDatabase) truncateAllContent(sender *qt.QTreeWidgetItem, bucketPath []string) error { func (ld *lmdbDatabase) truncateAllContent(sender *qt.QTreeWidgetItem, bucketPath []string) error {
// TODO add warning
//} if !vcl_confirm_dialog(sender.TreeWidget().QWidget, fmt.Sprintf("Are you sure you want to empty the child database %q?", bucketPath[0])) {
return nil // cancelled
}
return ld.drop(bucketPath[0], true)
}
func (ld *lmdbDatabase) deleteChildDatabase(sender *qt.QTreeWidgetItem, bucketPath []string) error { func (ld *lmdbDatabase) deleteChildDatabase(sender *qt.QTreeWidgetItem, bucketPath []string) error {
@@ -188,8 +193,12 @@ func (ld *lmdbDatabase) deleteChildDatabase(sender *qt.QTreeWidgetItem, bucketPa
return nil // cancelled return nil // cancelled
} }
return ld.drop(bucketPath[0], true)
}
func (ld *lmdbDatabase) drop(multiDbName string, delet bool) error {
return ld.db.Update(func(txn *lmdb.Txn) error { return ld.db.Update(func(txn *lmdb.Txn) error {
dbi, err := txn.OpenDBI(bucketPath[0], 0) dbi, err := txn.OpenDBI(multiDbName, 0)
if err != nil { if err != nil {
return err return err
} }
@@ -208,6 +217,7 @@ func (ld *lmdbDatabase) NavContext(bucketPath []string) ([]contextAction, error)
}, nil }, nil
} else { } else {
return []contextAction{ return []contextAction{
contextAction{"Truncate and remove all contents...", ld.truncateAllContent},
contextAction{"Remove child database...", ld.deleteChildDatabase}, contextAction{"Remove child database...", ld.deleteChildDatabase},
}, nil }, nil
} }

View File

@@ -18,8 +18,7 @@ import (
) )
// MongoDB support // MongoDB support
// To test: // To test: `make test-mongo`
// sudo docker run --rm -p 127.0.0.1:27017:27017 -e MONGO_INITDB_ROOT_USERNAME=root -e MONGO_INITDB_ROOT_PASSWORD=toor mongo:latest
type mongoLdb struct { type mongoLdb struct {
client *mongo.Client client *mongo.Client
@@ -49,13 +48,23 @@ func (ld *mongoLdb) Properties(bucketPath []string) (string, error) {
info := "Database " + db.Name() + "\n" info := "Database " + db.Name() + "\n"
info += "Collection " + coll.Name() + "\n" info += "Collection " + coll.Name() + "\n"
// Document count
count, err := coll.EstimatedDocumentCount(ctx) count, err := coll.EstimatedDocumentCount(ctx)
if err != nil { if err != nil {
return "", err return "", fmt.Errorf("Estimating document count: %w", err)
} }
info += fmt.Sprintf("Estimated document count: %d", count) + "\n" info += fmt.Sprintf("Estimated document count: %d", count) + "\n"
// TODO return more details // Index info
allIndexes, err := coll.Indexes().ListSpecifications(ctx)
if err != nil {
return "", fmt.Errorf("Checking indexes: %w", err)
}
info += fmt.Sprintf("\nIndexes (%d):\n", len(allIndexes))
for _, idxInfo := range allIndexes {
info += fmt.Sprintf("- %q (namespace=%q, version=%d)\n", idxInfo.Name, idxInfo.Namespace, idxInfo.Version)
}
return info, nil return info, nil

View File

@@ -37,7 +37,7 @@ func (ld *secretServiceDb) RenderForNav(f *tableState, bucketPath []string) erro
} else if len(bucketPath) == 1 { } else if len(bucketPath) == 1 {
f.SetupColumns( f.SetupColumns(
slice_repeat(columnType_inlineText, 6), []columnType{columnType_inlineText, columnType_inlineText, columnType_inlineText, columnType_inlineText, columnType_inlineText, columnType_popupData},
[]string{"ID", "Label", "Attributes", "ContentType", "Parameters", "Value"}, []string{"ID", "Label", "Attributes", "ContentType", "Parameters", "Value"},
) )
@@ -74,13 +74,12 @@ func (ld *secretServiceDb) RenderForNav(f *tableState, bucketPath []string) erro
} }
f.AddRowData( f.AddRowData(
// All strings
string(item), // ID string(item), // ID
label.Value().(string), // Label label.Value().(string), // Label
attrs.String(), // Attributes (JSON) attrs.String(), // Attributes (JSON)
secr.ContentType, // ContentType secr.ContentType, // ContentType
string(secr.Parameters), // Parameters string(secr.Parameters), // Parameters
string(secr.Value), // Value secr.Value, // Value - []byte
) )
} }

6
go.mod
View File

@@ -10,15 +10,18 @@ require (
github.com/godbus/dbus/v5 v5.2.0 github.com/godbus/dbus/v5 v5.2.0
github.com/google/uuid v1.6.0 github.com/google/uuid v1.6.0
github.com/ledgerwatch/lmdb-go v1.18.2 github.com/ledgerwatch/lmdb-go v1.18.2
github.com/lotusdblabs/lotusdb/v2 v2.1.0
github.com/mappu/autoconfig v0.4.1 github.com/mappu/autoconfig v0.4.1
github.com/mappu/miqt v0.12.1-0.20251106063543-466b60e47edf github.com/mappu/miqt v0.12.1-0.20251106063543-466b60e47edf
github.com/mattn/go-sqlite3 v1.14.32 github.com/mattn/go-sqlite3 v1.14.32
github.com/redis/go-redis/v9 v9.17.2 github.com/redis/go-redis/v9 v9.17.2
github.com/rosedblabs/rosedb/v2 v2.3.6
github.com/starskey-io/starskey v0.1.9 github.com/starskey-io/starskey v0.1.9
github.com/stretchr/testify v1.11.1 github.com/stretchr/testify v1.11.1
github.com/syndtr/goleveldb v1.0.0 github.com/syndtr/goleveldb v1.0.0
github.com/zalando/go-keyring v0.2.6 github.com/zalando/go-keyring v0.2.6
go.etcd.io/bbolt v1.4.3 go.etcd.io/bbolt v1.4.3
go.mills.io/bitcask/v2 v2.1.5
go.mongodb.org/mongo-driver/v2 v2.4.1 go.mongodb.org/mongo-driver/v2 v2.4.1
golang.org/x/crypto v0.46.0 golang.org/x/crypto v0.46.0
) )
@@ -54,7 +57,6 @@ require (
github.com/klauspost/cpuid/v2 v2.3.0 // indirect github.com/klauspost/cpuid/v2 v2.3.0 // indirect
github.com/kr/pretty v0.3.1 // indirect github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect github.com/kr/text v0.2.0 // indirect
github.com/lotusdblabs/lotusdb/v2 v2.1.0 // indirect
github.com/mattetti/filebuffer v1.0.1 // indirect github.com/mattetti/filebuffer v1.0.1 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pkg/errors v0.9.1 // indirect github.com/pkg/errors v0.9.1 // indirect
@@ -66,7 +68,6 @@ require (
github.com/robfig/cron/v3 v3.0.0 // indirect github.com/robfig/cron/v3 v3.0.0 // indirect
github.com/rogpeppe/go-internal v1.14.1 // indirect github.com/rogpeppe/go-internal v1.14.1 // indirect
github.com/rosedblabs/diskhash v0.0.0-20230910084041-289755737e2a // indirect github.com/rosedblabs/diskhash v0.0.0-20230910084041-289755737e2a // indirect
github.com/rosedblabs/rosedb/v2 v2.3.6 // indirect
github.com/rosedblabs/wal v1.3.6 // indirect github.com/rosedblabs/wal v1.3.6 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect github.com/sirupsen/logrus v1.9.3 // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect
@@ -76,7 +77,6 @@ require (
github.com/xdg-go/stringprep v1.0.4 // indirect github.com/xdg-go/stringprep v1.0.4 // indirect
github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 // indirect github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 // indirect
github.com/zeebo/xxh3 v1.0.2 // indirect github.com/zeebo/xxh3 v1.0.2 // indirect
go.mills.io/bitcask/v2 v2.1.5 // indirect
go.mongodb.org/mongo-driver v1.17.6 // indirect go.mongodb.org/mongo-driver v1.17.6 // indirect
go.opentelemetry.io/auto/sdk v1.2.1 // indirect go.opentelemetry.io/auto/sdk v1.2.1 // indirect
go.opentelemetry.io/otel v1.39.0 // indirect go.opentelemetry.io/otel v1.39.0 // indirect

14
go.sum
View File

@@ -32,8 +32,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3
github.com/danieljoos/wincred v1.2.3 h1:v7dZC2x32Ut3nEfRH+vhoZGvN72+dQ/snVXo/vMFLdQ= github.com/danieljoos/wincred v1.2.3 h1:v7dZC2x32Ut3nEfRH+vhoZGvN72+dQ/snVXo/vMFLdQ=
github.com/danieljoos/wincred v1.2.3/go.mod h1:6qqX0WNrS4RzPZ1tnroDzq9kY3fu1KwE7MRLQK4X0bs= github.com/danieljoos/wincred v1.2.3/go.mod h1:6qqX0WNrS4RzPZ1tnroDzq9kY3fu1KwE7MRLQK4X0bs=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dgraph-io/badger/v4 v4.8.0 h1:JYph1ChBijCw8SLeybvPINizbDKWZ5n/GYbz2yhN/bs= github.com/dgraph-io/badger/v4 v4.8.0 h1:JYph1ChBijCw8SLeybvPINizbDKWZ5n/GYbz2yhN/bs=
github.com/dgraph-io/badger/v4 v4.8.0/go.mod h1:U6on6e8k/RTbUWxqKR0MvugJuVmkxSNc79ap4917h4w= github.com/dgraph-io/badger/v4 v4.8.0/go.mod h1:U6on6e8k/RTbUWxqKR0MvugJuVmkxSNc79ap4917h4w=
@@ -76,13 +76,17 @@ github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00 h1:l5lAOZEym3oK3SQ2HBHWsJUfbNBiTXJDeW2QDxw9AQ0=
github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/hashicorp/go-immutable-radix/v2 v2.0.0 h1:nq9lQ5I71Heg2lRb2/+szuIWKY3Y73d8YKyXyN91WzU= github.com/hashicorp/go-immutable-radix/v2 v2.0.0 h1:nq9lQ5I71Heg2lRb2/+szuIWKY3Y73d8YKyXyN91WzU=
github.com/hashicorp/go-immutable-radix/v2 v2.0.0/go.mod h1:hgdqLXA4f6NIjRVisM1TJ9aOJVNRqKZj+xDGF6m7PBw= github.com/hashicorp/go-immutable-radix/v2 v2.0.0/go.mod h1:hgdqLXA4f6NIjRVisM1TJ9aOJVNRqKZj+xDGF6m7PBw=
github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8=
github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k=
github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM=
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
@@ -118,8 +122,8 @@ github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTw
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o=
github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg= github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg=
@@ -140,16 +144,14 @@ github.com/rosedblabs/diskhash v0.0.0-20230910084041-289755737e2a h1:BNp46nsknQi
github.com/rosedblabs/diskhash v0.0.0-20230910084041-289755737e2a/go.mod h1:3xvIg+7iOFUL/vMCE/6DwE6Yecb0okVYJBEfpdC/E+8= github.com/rosedblabs/diskhash v0.0.0-20230910084041-289755737e2a/go.mod h1:3xvIg+7iOFUL/vMCE/6DwE6Yecb0okVYJBEfpdC/E+8=
github.com/rosedblabs/rosedb/v2 v2.3.6 h1:o8vVOp61hFdORrz/PTosqU21/Z2Bug5I7cy1D3MZh2M= github.com/rosedblabs/rosedb/v2 v2.3.6 h1:o8vVOp61hFdORrz/PTosqU21/Z2Bug5I7cy1D3MZh2M=
github.com/rosedblabs/rosedb/v2 v2.3.6/go.mod h1:/de9n2CoYaAGBDxZTJC5Jb0LCQOtoA3GOom+9QD9Z98= github.com/rosedblabs/rosedb/v2 v2.3.6/go.mod h1:/de9n2CoYaAGBDxZTJC5Jb0LCQOtoA3GOom+9QD9Z98=
github.com/rosedblabs/rosedb/v2 v2.4.0 h1:gwI3zHm5tJlvCb6DMtHEhHsq/BiWS2vNS7Lg409ii6k=
github.com/rosedblabs/rosedb/v2 v2.4.0/go.mod h1:yehP2SiNojwdleiYhvjQU9jWPuXhO7hbWBzohueVPVY=
github.com/rosedblabs/wal v1.3.6 h1:oxZYTPX/u4JuGDW98wQ1YamWqerlrlSUFKhgP6Gd/Ao= github.com/rosedblabs/wal v1.3.6 h1:oxZYTPX/u4JuGDW98wQ1YamWqerlrlSUFKhgP6Gd/Ao=
github.com/rosedblabs/wal v1.3.6/go.mod h1:wdq54KJUyVTOv1uddMc6Cdh2d/YCIo8yjcwJAb1RCEM= github.com/rosedblabs/wal v1.3.6/go.mod h1:wdq54KJUyVTOv1uddMc6Cdh2d/YCIo8yjcwJAb1RCEM=
github.com/rosedblabs/wal v1.3.8 h1:tErpD9JT/ICiyV3mv5l7qUH6lybn5XF1TbI0e8kvH8M=
github.com/rosedblabs/wal v1.3.8/go.mod h1:DFvhrmTTeiXvn2btXXT2MW9Nvu99PU0g/pKGgh0+T+o=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/assertions v1.2.0 h1:42S6lae5dvLc7BrLu/0ugRtcFVjoJNMC/N3yZFZkDFs=
github.com/smartystreets/assertions v1.2.0/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo= github.com/smartystreets/assertions v1.2.0/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo=
github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s=
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI=
github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=

11
main.go
View File

@@ -7,7 +7,7 @@ import (
"os" "os"
"strings" "strings"
"github.com/mappu/miqt/qt/mainthread" "github.com/mappu/miqt/qt6/mainthread"
qt "github.com/mappu/miqt/qt6" qt "github.com/mappu/miqt/qt6"
) )
@@ -277,7 +277,7 @@ func (f *App) OnDataCommitClick() {
f.refreshContent(node) // Refresh RHS pane/data content f.refreshContent(node) // Refresh RHS pane/data content
// Preserve scroll position // Preserve scroll position
// TODO // (Happens automatically with QTableView)
} }
func (f *App) OnNavContextClose() { func (f *App) OnNavContextClose() {
@@ -422,6 +422,12 @@ func (f *App) OnNavChange(node *qt.QTreeWidgetItem, prev *qt.QTreeWidgetItem) {
} }
} }
if node != prev {
// Changing tables (not just refreshing the current table)
// Reset scroll position to top
f.ui.contentBox.ScrollToTop()
}
// OK, continue with change // OK, continue with change
f.refreshContent(node) f.refreshContent(node)
} }
@@ -461,6 +467,7 @@ func (f *App) refreshContent(node *qt.QTreeWidgetItem) {
// Toggle the Edit functionality // Toggle the Edit functionality
// Do this *after* RenderForNav as it disables editing by default. // Do this *after* RenderForNav as it disables editing by default.
_, editable := ld.(editableLoadedDatabase) _, editable := ld.(editableLoadedDatabase)
editable = editable && f.contentTbl.IsReady() // if there was a failure loading, don't allow edit
f.ui.actionApply_changes.SetEnabled(false) // will be enabled after add/delete/edit f.ui.actionApply_changes.SetEnabled(false) // will be enabled after add/delete/edit
f.ui.actionDelete_row.SetEnabled(editable) f.ui.actionDelete_row.SetEnabled(editable)
f.ui.actionAddRow.SetEnabled(editable) f.ui.actionAddRow.SetEnabled(editable)

View File

@@ -5,10 +5,12 @@ import (
"errors" "errors"
"fmt" "fmt"
"os" "os"
"path/filepath"
"github.com/mappu/autoconfig" "github.com/mappu/autoconfig"
qt "github.com/mappu/miqt/qt6" qt "github.com/mappu/miqt/qt6"
"golang.org/x/crypto/ssh" "golang.org/x/crypto/ssh"
"golang.org/x/crypto/ssh/knownhosts"
) )
type SSHTunnel struct { type SSHTunnel struct {
@@ -29,10 +31,32 @@ type SSHTunnel struct {
PrivateKeyContentPassword autoconfig.Password `ylabel:"Password (optional)"` PrivateKeyContentPassword autoconfig.Password `ylabel:"Password (optional)"`
} `ylabel:"Private key (Internal)"` } `ylabel:"Private key (Internal)"`
} }
H2 autoconfig.Header `ylabel:"Server host key:" json:",omitempty"`
HostVerification struct {
Type autoconfig.OneOf
InsecureSkipVerify *struct{}
ExternalKnownHostsFile *struct {
Path autoconfig.ExistingFile
}
}
} }
func (s *SSHTunnel) Reset() { // Used by autoconfig package when creating a new value func (s *SSHTunnel) Reset() { // Used by autoconfig package when creating a new value
s.Server.Port = 22 s.Server.Port = 22
if homeDir, err := os.UserHomeDir(); err == nil {
defaultKnownHostsFile := filepath.Join(homeDir, `.ssh`, `known_hosts`)
if _, err := os.Stat(defaultKnownHostsFile); err == nil {
s.HostVerification.Type = "ExternalKnownHostsFile"
alloc_inplace(&s.HostVerification.ExternalKnownHostsFile)
s.HostVerification.ExternalKnownHostsFile.Path = autoconfig.ExistingFile(defaultKnownHostsFile)
}
}
if s.HostVerification.Type == "" {
s.HostVerification.Type = "InsecureSkipVerify"
alloc_inplace(&s.HostVerification.InsecureSkipVerify)
}
} }
func (s *SSHTunnel) String() string { func (s *SSHTunnel) String() string {
@@ -56,7 +80,6 @@ func (s SSHTunnel) Open(ctx context.Context) (*ssh.Client, error) {
return nil return nil
}, },
HostKeyCallback: ssh.InsecureIgnoreHostKey(), // FIXME
User: s.Username, User: s.Username,
} }
@@ -86,6 +109,28 @@ func (s SSHTunnel) Open(ctx context.Context) (*ssh.Client, error) {
return nil, fmt.Errorf("Parsing private key: %w", err) return nil, fmt.Errorf("Parsing private key: %w", err)
} }
cfg.Auth = append(cfg.Auth, ssh.PublicKeys(signer)) cfg.Auth = append(cfg.Auth, ssh.PublicKeys(signer))
} else {
return nil, fmt.Errorf("Unsupported value %q for Auth", s.Auth.Type)
}
//
if s.HostVerification.Type == "" || s.HostVerification.InsecureSkipVerify != nil {
cfg.HostKeyCallback = ssh.InsecureIgnoreHostKey()
} else if s.HostVerification.ExternalKnownHostsFile != nil {
cb, err := knownhosts.New(string(s.HostVerification.ExternalKnownHostsFile.Path))
if err != nil {
return nil, fmt.Errorf("Parsing known_hosts file %q: %w")
}
cfg.HostKeyCallback = cb
} else {
return nil, fmt.Errorf("Unsupported value %q for HostVerification", s.HostVerification.Type)
} }
// TODO DialContext // TODO DialContext

View File

@@ -202,6 +202,10 @@ func (ts *tableState) Ready() {
ts.tbl.SetEnabled(true) ts.tbl.SetEnabled(true)
} }
func (ts *tableState) IsReady() bool {
return ts.tbl.IsEnabled()
}
// DeleteSelectedRows marks the selected rows for deletion. // DeleteSelectedRows marks the selected rows for deletion.
func (ts *tableState) DeleteSelectedRows() { func (ts *tableState) DeleteSelectedRows() {
rows := ts.tbl.SelectionModel().SelectedRows() rows := ts.tbl.SelectionModel().SelectedRows()

View File

@@ -32,6 +32,7 @@ func (bc *binColumn) Display(aRow int) *qt.QVariant {
func (bc *binColumn) Inspect(parent *qt.QWidget, aRow int) { func (bc *binColumn) Inspect(parent *qt.QWidget, aRow int) {
// do nothing // do nothing
// TODO support hexview for noneditable columns
} }
func (bc *binColumn) SimpleEditData(aRow int) *qt.QVariant { func (bc *binColumn) SimpleEditData(aRow int) *qt.QVariant {

View File

@@ -94,3 +94,8 @@ func bson_find_id(doc bson.D) (string, bool) {
return "", false return "", false
} }
func alloc_inplace[T any](target **T) {
var newObj T
*target = &newObj
}