skeg_client

Gleam client for skeg, a key-value and vector store.

Connect over RESP3 and use the command modules:

import skeg_client/connection
import skeg_client/kv
import skeg_client/vector

pub fn main() {
  let assert Ok(conn) =
    connection.new("127.0.0.1", 6379)
    |> connection.credentials(username: "alice", password: "secret")
    |> connection.connect
  let assert Ok(Nil) = kv.set(conn, <<"greeting">>, <<"hello">>)
  let assert Ok(Nil) = vector.create(conn, vector.index("docs", 4))
  let assert Ok(Nil) = vector.set(conn, "docs", 1, [0.1, 0.2, 0.3, 0.4])
  let assert Ok(hits) =
    vector.search(conn, "docs", vector.query([0.1, 0.2, 0.3, 0.4], 5))
  connection.close(conn)
}

skeg_client/binary speaks skeg’s native protocol. It has no authentication and covers only the commands listed in its module.

Values

pub fn connect(
  host: String,
  port: Int,
) -> Result(connection.Connection, error.Error)

Connects without credentials and with the default timeouts. Use skeg_client/connection to set credentials or timeouts.

✨ Search Document