surrealdb / surrealdb.go

SurrealDB SDK for Golang
https://surrealdb.com
Apache License 2.0
232 stars 60 forks source link

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

Open louisescher opened 4 months ago

louisescher commented 4 months ago

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?

Code of Conduct

ElecTwix commented 4 months ago

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.

louisescher commented 4 months ago

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?

ElecTwix commented 4 months ago

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
infogulch commented 4 months ago

There have been 28 commits so far on main (updated ~2mo ago) since v0.2.1 (tagged 1y ago): https://github.com/surrealdb/surrealdb.go/compare/v0.2.1...main

Johjoh-6 commented 2 months ago

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.

ElecTwix commented 2 months ago

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.