SurrealdbWS.jl

Author YuriMiyamori
Popularity
0 Stars
Updated Last
7 Months Ago
Started In
May 2023

SurrealdbWS

Build Status Coverage

The SurrealDB driver for Julia via WebSocket(unofficial)

Getting Started

First install SurrealDB if you haven't already.

Installation

using Pkg
Pkg.add("SurrealdbWS")

Usage

Do-Block Syntax

using SurrealdbWS
res = Surreal("ws://localhost:8000/rpc") do db
  connect(db)
  signin(db, user="root", pass="root")
  use(db, namespace="test", database="test")
  create(db, thing="planet", data=Dict("name"=>"Earth","radius"=>6371))
  create(db, thing="planet", data=Dict("name"=>"Mars","radius"=>3389))
  create(db, thing="planet", data=Dict("name"=>"Jupiter","radius"=>58232))
  merge(db, thing="planet", data=Dict("Star"=>"Sun"))
  query(db, sql=
  """
  --sql
  SELECT * FROM planet WHERE radius<10_000;
  """
  )
  res
end

Close manulally for e.g. notebooks

using SurrealdbWS
db = Surreal("ws://localhost:8000/rpc")
connect(db)
signin(db,user="root", pass="root")
use(db, namespace="test", database="test")
create(db, thing="person",
        data = Dict("user"=> "me","pass"=> "safe","marketing"=> true,
            "tags"=> ["python", "documentation"]))
delete(db, thing="person")
close(db)

Used By Packages

No packages found.