surrealdb/surrealdb.go

Documentation: Add Documentation for .Live() func & other stuff related to LIVE queries

Opened this issue · 6 comments

Description

Hi,
I've been working with SurrealDB in Go for quite a while now, and I wanted to start experimenting with LIVE selects now. The SDK includes the function (in v0.2.1), but I cannot find any documentation regarding LIVE queries, neither for the .Live() func, nor for any implementation via the .Query() func. The latter would be more important, since I need to chain a WHERE statement at the end.
Am I missing something here? Any help would be appreciated.

Is there an existing issue for this?

  • I have searched the existing issues

Code of Conduct

  • I agree to follow this project's Code of Conduct

Hi @louisescher,

Thanks for your issue.

but I cannot find any documentation regarding LIVE queries

The master branch supports live queries but the doc for stable and stable does not include live queries atm.

If you want to use I recommend using the latest commit and for how to use checkout our unit tests I will put a link to live query usage.
live queries unit test
Look into TestLiveViaMethod, TestLiveWithOptionsViaMethod, TestLiveViaQuery.

Hope this helps! Feel free to ask if you have any more questions.

Hi @ElecTwix,
Thanks for the quick response!

Look into TestLiveViaMethod, TestLiveWithOptionsViaMethod, TestLiveViaQuery.

When checking TestLiveViaQuery, a func called LiveNotifications is used. (See here)
Unfortunately, this func does not seem to be available in v0.2.1 of the SDK. I assume this means I'll have to wait for a future version?

Hi @ElecTwix, Thanks for the quick response!

Look into TestLiveViaMethod, TestLiveWithOptionsViaMethod, TestLiveViaQuery.

When checking TestLiveViaQuery, a func called LiveNotifications is used. (See here) Unfortunately, this func does not seem to be available in v0.2.1 of the SDK. I assume this means I'll have to wait for a future version?

Yes unfortunately not available in v0.2.1. You can still use it by using the latest commit for the package but we are aware it can induce some breaking changes to the driver such as function changes etc.

Still want to try to use the latest commit with this command.

go get github.com/surrealdb/surrealdb.go@7c2584a964ab985a34bfa8179a3d815888eff890

There have been 28 commits so far on main (updated ~2mo ago) since v0.2.1 (tagged 1y ago): v0.2.1...main

There is more that only Live missing.
We miss as well these functions like SmartUnmarshal and SmartMarshal.

And I think there is an error
In New() on the documentation it says to support WS and HTTP. But when we try and Http we get this response
malformed ws or wss URL.

Hi @Johjoh-6,

There is more that only Live missing. We miss as well these functions like SmartUnmarshal and SmartMarshal.

In OC PR it was have it then removed due to they are helper functions.

And I think there is an error
In New() on the documentation it says to support WS and HTTP. But when we try and Http we get this response
malformed ws or wss URL.

Yeah that right. I'm waiting the Golang PR's to merge and change of WS impl then I will update the docs but it takes too long I created some PR's month ago so it depend of reviewers.