This plugin is on huge DEVELOPMENT MODE, expect bugs and BREAKING CHANGES if using it for now.
https://github.com/Sanix-Darker/dockdb.nvim/assets/22576758/08160855-4ba4-47de-a9ba-ac5d218a92db
While working with SQL
, i wanted to bind my nvim edition flow with the way i run and test my queries.
However, i wanted something extremly simple and light,
with no 'third-party' lib/cli to install, so that on a fresh new server this should be working fine; so i made dockdb.nvim that run the visual selected query
to an 'already' running DataBase Container
.
session
YET here, it's a ONE QUERY HIT, like a command you run inside a container, from outside, get the output and exit.The simple idea behind this plugin is to:
Using Packer :
use 'Sanix-Darker/dockdb.nvim'
Using Vim-plug :
Plug 'Sanix-Darker/dockdb.nvim'
Using LazyNvim :
{
"Sanix-Darker/dockdb.nvim",
opts = {
-- config stuff here
},
},
Execute the visual selected lines on the first found running container :
DockDbExecMongo
DockDbExecMySQL
DockDbExecMSSQL
DockDbExecMariaDB
DockDbExecOracle
DockDbExecPostgresSQL
DockDbExecRedis
DockDbExecMemCached
See examples for queries to play.
Options values are extremly flexible depending on the database you're using, for example :
-- common config you could set on all engine
local common_conf = {
username = 'u',
password = 'p',
database = 'TESTDB',
hostname = 'localhost',
}
local dockdb_ops = {
mysql = {
port = '3306'
},
postgresql = {
port = '5432'
},
oracle = {
oracle_sid = 'XE',
username = 'system', -- this will be used instead of 'u'
port = '1521'
},
mongodb = {
port = '27017'
},
redis = {
port = '6479'
}
memcached = {
port = '11211'
}
}
for _, config in pairs(dockdb_ops) do
for k, v in pairs(common_conf) do
-- You can use this to set the config for a specific
-- engine to overide the defaulf from common_conf
-- like for oracle.
if config[k] == nil then
config[k] = v
end
end
end
-- then we call dockdb
require("dockdb").setup(dockdb_ops)
If you have some ideas on how to upgrade this plugin i would be happy to read your issues, suggestions, Pull Requests. But for now i will keep it simple since it does what i want it to do for now.