Run database queries from nvim. Query.nvim is a work in progress, expect things to change.
Plug 'nvim-lua/plenary.nvim'
Plug 'chris-burgin/query.nvim'
local query_nvim = require("query_nvim")
local connectors = require('query_nvim/connectors')
require('query_nvim').setup({
db = {
test = connectors.mysql({
user = "root",
host = "127.0.0.1",
database = "test",
}),
demo = connectors.mysql({
user = "root",
host = "127.0.0.1",
database = "demo",
}),
},
})
Connectors are provided to the query_nvim
setup function.
local connectors = require('query_nvim/connectors')
connectors.mysql(...config)
Config Param | Description | Required |
---|---|---|
user | The database user | yes |
password | Password for the user | no |
host | The host on which to connect | yes |
database | The database to query against | yes |
To define a custom connector for a database not supported look at connectors.lua for examples.
Type :Query
and hit tab
to see a list of commands.
Command | Description |
---|---|
query | Runs the provided query. :Query query [db.name] [query] |
visual | Runs the current Visual Selection as a query. :Query visual [db.name] |
visual_r | Same as selection plus it accepts a list of replacements (? ) as a CSV. Note strings must be wrapped in quotes. |
❗ Screenshots are out of date and do not show the required db.name
param. ❗