Home

Awesome

nvim-databasehelper

Features

Currently supported language servers

Requires

Example Setup

WARNING: don't setup your LSP server manually, as you'll end up with multiple active clients.

require('nvim-databasehelper').setup(
    {
        lsp = {
            sqls = config, -- config you'd pass to lspconfig["sqls"].setup(). Omit the connections!
        },
        docker = {
            enabled = true,
            must_contain = { 'some' }, -- only show Docker containers that contain one of the given strings
            defaults = { -- when selecting a Docker container you'll be prompted for various parameters, you can define default values here
                postgresql = {
                    user = 'postgres',
                    password = 'somePassword',
                    initial_database = 'testdb',
                }
            }
        },
        dadbod = {
            enabled = true,
            var = 'dadbodstring', -- global Vim variable to use for dadbod ":DB g:<thisvariable> ..."
        },
        connections = {
            system = {
                initial_database = 'benchmark',
                driver = 'postgresql',
                host = '127.0.0.1',
                port = '5432',
                user = 'postgres',
                password = '',
            }
        },
        initial_window_height = 10,
    }
)

Commands

CommandFunction
SwitchDatabaseswitch database. Autocomplete or select window.
ExecuteOnDatabaseexecute buffer or visual selection on specific database.
ExecuteOnConnectionexecute buffer or visual selection on specific connection.
OpenDatabaseWindowopens a new buffer in the current window where you can write your query. Useful if you want LSP functionality.
StartContainerStarts the selected docker container
StopContainerStops the selected docker container