Prerequisites
- Go 1.21 or later
- QueryBox source code (for access to
pkg/plugin) - Basic understanding of the database/driver you’re integrating
Template Plugin
QueryBox includes a complete template plugin atplugins/template/main.go that demonstrates all required and optional commands.
Create main.go
Create The
main.go with the basic structure:UnimplementedPluginServiceServer provides default implementations for optional methods.Implement Info command
The
Info command returns metadata about your plugin:capabilities array tells QueryBox what features your plugin supports (e.g., "explain-query", "transactions").Implement AuthForms command
Define authentication forms that users fill out to connect:Available field types:
AuthFieldText- Text inputAuthFieldNumber- Numeric inputAuthFieldPassword- Password input (masked)AuthFieldSelect- Dropdown selectAuthFieldCheckbox- Boolean checkboxAuthFieldFilePath- File picker
Implement Exec command
The For SQL databases, return
Exec command executes queries and returns results. Here’s a simple key-value example:SqlResult instead:Complete Template Example
Here’s the complete template plugin fromplugins/template/main.go:
Next Steps
Connection Tree
Add browseable database structure
Plugin Contract
Learn the complete protobuf specification