1.0.6 • Published 2 years ago

surrealdb-driver v1.0.6

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

surrealdb-driver

This package provides a asynchronously "RPC-Wrapper" / driver for SurrealDB using ws.

Why?

Actually SurrealDB provides a "wrapper" / driver created by some users (surrealdb.js), but I didn't like the code at all. That's why I started to create my own "wrapper" / driver with a better & readable code.

Example

Example of how to select from persons table:

(async () => {
  const surreal = new Surreal({
    host: '127.0.0.1',
    port: 8000,
    user: 'user',
    pass: 'password',
    ns: 'myNamespace',
    db: 'myDatabase',
    ssl: false,
  });

  await surreal.signIn();

  const persons = await surreal.select<
    {company: string; id: string; name: string; skills: string[]}[]
  >('persons');

  persons.forEach((e) => console.log(e));
})();

Result:

{
  company: 'SurrealDB',
  id: 'users:x173nmutw0nzrt4fnixz',
  name: 'Tobie',
  skills: [ 'Rust', 'Go', 'JavaScript' ]
}
1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago