View Source Getting Started

Authentication

You can click here to generate a new auth-key.

Installation

Add DBVisor to your hex repos:

Local

mix hex.repo add db_visor https://dbvisor.com \
--fetch-public-key SHA256:PDVAHxqZx9mhFZ6lM/kmJGl1o6SQrfUDEVqMiRZ1DLs \
--auth-key DBVISOR_AUTH_KEY

CI

- name: Installing DBVisor hex repo
  run: |
    mix hex.repo add db_visor https://dbvisor.com \
      --fetch-public-key SHA256:PDVAHxqZx9mhFZ6lM/kmJGl1o6SQrfUDEVqMiRZ1DLs \
      --auth-key ${{secrets.dbvisor_auth_key}}

Add DBVisor to your mix.exs:

def deps do
  [
    {:db_visor, "~> 0.3.2", repo: :db_visor}
  ]
end

Add DBVisor in your router:

  scope "/" do
    pipe_through [DBVisor.Hint]
    live "/", DBVisor.Live
  end

Configuration

The following option can be configured:

  • :auth_key configures the authentication key, used to retrieve :db_visor, defaults to: nil.

  • :editor configures the editor, e.g. code://__FILE__:__LINE__. defaults to: nil.

  • :github_token configures the token used to resolved dependencies for the interactive stacktrace. defaults to: nil.

  • :permit? configures the MFA used to control delete, insert, update or if a field is queryable, the function will always receive changeset_or_query, socket or changeset_or_struct, field, socket. defaults to: {DBVisor, :permit?, []}.

Filtering

Filter is done via query params, the following operators are available: in, nin, eq, neq, between, lt, gt, lte, gte, like, ilike.

Example

iex> Plug.Conn.Query.encode(%{"filter" => %{"0" => %{"id" => %{"in" => ["1", "2", "3"]}}}})
"filter[0][id][in][]=1&filter[0][id][in][]=2&filter[0][id][in][]=3"

iex> Plug.Conn.Query.encode(%{"filter" => %{"apply" => "and", "0" => %{"id" => %{"in" => ["1", "2", "3"]}}}})
"filter[0][id][in][]=1&filter[0][id][in][]=2&filter[0][id][in][]=3&filter[apply]=and"

Ordering

Any field can be order by asc or desc.

Example

iex> Plug.Conn.Query.encode(%{"asc" => "email"})
"asc=email"