Git Product home page Git Product logo

nvim-databasehelper's Introduction

nvim-databasehelper

Features

  • define various connections
  • discover Docker containers on demand
  • discover databases on connections/containers
  • change running database connection
    • restart LSP with proper connection
    • update vim-dadbod global connection string
  • execute statements (via vim-dadbod)
    • execute for different database/connection
  • caches Docker information for repeated usage
  • start/stop docker containers

Currently supported language servers

  • Postgres: sqls, sqlls is broken (see here)

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

Command Function
SwitchDatabase switch database. Autocomplete or select window.
ExecuteOnDatabase execute buffer or visual selection on specific database.
ExecuteOnConnection execute buffer or visual selection on specific connection.
OpenDatabaseWindow opens a new buffer in the current window where you can write your query. Useful if you want LSP functionality.
StartContainer Starts the selected docker container
StopContainer Stops the selected docker container

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.