Qdrantex.Repo (Qdrantex v1.8.0)

Default implementation for Qdrantex.Repo

You can use it in your application, simply add it to the supervision tree.

Configuration:

config :qdrantex, Qdrantex.Repo,
  api_key: "your_secret_api_key_here"

Summary

Functions

Executes a query. It accepts module, rpc name as atom and struct %...Request{} as data.

Executes a query. It accepts a closure that accepts GRPC.Channel.t() as an argument. This channel will be substituted with the actual channel during the execution, channel will be provided by the Repo itself.

Starts Repo under supervision tree. It accepts options as a keyword list. Options will be combined with hardcoded options from use statement, and with the configuration from the application.

Functions

Link to this function

execute(module, rpc, data)

@spec execute(atom(), atom(), map()) :: {:ok, map()} | {:error, any()}

Executes a query. It accepts module, rpc name as atom and struct %...Request{} as data.

Example:

Qdrantex.Repo.execute(Qdrantex.Qdrant.Qdrant.Stub, :health_check, %Qdrantex.Qdrant.HealthCheckRequest{})
@spec run(closure :: (GRPC.Channel.t() -> any())) :: {:ok, map()} | {:error, any()}

Executes a query. It accepts a closure that accepts GRPC.Channel.t() as an argument. This channel will be substituted with the actual channel during the execution, channel will be provided by the Repo itself.

You can generate this closure with simplified syntax from *.Stub gRPC nodules:

Example:

  Qdrantex.Repo.run(&Qdrantex.Qdrant.Stub.health_check(&1, %Qdrantex.Qdrant.HealthCheckRequest{}))
Link to this function

start_link(opts)

@spec start_link(Keyword.t()) :: GenServer.on_start()

Starts Repo under supervision tree. It accepts options as a keyword list. Options will be combined with hardcoded options from use statement, and with the configuration from the application.

Options:

  • :hostname - the hostname of the Qdrant service. Default is "localhost".

  • :port - the port of the Qdrant service. Default is 6333.

  • :otp_app - the name of the OTP application. Required, but commonly set in use statement.

  • :api_key - the API key for the Qdrantex service. Can be nil if Qdrant service does not require it.

  • :ssl - the SSL options for the connection. Can be nil if Qdrant service does not require it.

  • All options from DBConnection.start_link/2. All these are optional.