-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Add SurrealDB datasource support #1361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
58 commits
Select commit
Hold shift + click to select a range
8e41e54
surrealDB implementation
vaidehiadhi edb4080
added surrealDB support
vaidehiadhi 56ce727
Merge branch 'development' into surrealdb
Umang01-hash 0419cd4
resolved review suggestions
vaidehiadhi 58cd998
Merge branch 'surrealdb' of github.com:vaidehiadhi/gofr into surrealdb
vaidehiadhi 544d83f
Merge branch 'development' into surrealdb
Umang01-hash ebbc196
changed code to write tests using mocks instead of suits
vaidehiadhi f1d7257
Merge branch 'surrealdb' of github.com:vaidehiadhi/gofr into surrealdb
vaidehiadhi 52dd1d9
Merge branch 'development' into surrealdb
Umang01-hash 474ad37
changed code according to the review suggestions
vaidehiadhi eaae9bb
Merge branch 'surrealdb' of github.com:vaidehiadhi/gofr into surrealdb
vaidehiadhi 892e811
resolved linters
vaidehiadhi dbf2e52
fixed linters
vaidehiadhi 2978005
Merge branch 'development' into surrealdb
Umang01-hash 44318e8
resolved pr conflicts
vaidehiadhi ee1cadb
Merge branch 'surrealdb' of github.com:vaidehiadhi/gofr into surrealdb
vaidehiadhi 44911ef
fixed documentation
vaidehiadhi 7e4775e
Merge branch 'development' into surrealdb
Umang01-hash 753373f
resolved pr comments
vaidehiadhi d44e7aa
Merge branch 'surrealdb' of github.com:vaidehiadhi/gofr into surrealdb
vaidehiadhi e2aac2e
added traces support
vaidehiadhi bc5032c
resoved pr comments
vaidehiadhi 109325d
add id parameter in update method
vaidehiadhi 67b6350
Merge branch 'development' into surrealdb
Umang01-hash d141722
resolve pr comments
vaidehiadhi 0e8d7b1
Merge branch 'surrealdb' of github.com:vaidehiadhi/gofr into surrealdb
vaidehiadhi 8f2eb6d
added docker command in contribution
vaidehiadhi f577c5c
fixed merge conflict
vaidehiadhi ee577c9
added docs and mod improvements
vaidehiadhi 61510f5
added missing files
vaidehiadhi 811ff1a
Merge branch 'development' into surrealdb
Umang01-hash 051ff35
docker command
vaidehiadhi 78eb773
Merge branch 'surrealdb' of github.com:vaidehiadhi/gofr into surrealdb
vaidehiadhi 7e99bcd
docker command
vaidehiadhi 7bdc615
Merge branch 'development' into surrealdb
Umang01-hash 1279fe2
review suggestions
vaidehiadhi 5225086
Merge branch 'surrealdb' of github.com:vaidehiadhi/gofr into surrealdb
vaidehiadhi 0e4cb34
review comments and linters
vaidehiadhi 4c20be9
removed metrics
vaidehiadhi b8ea649
resolved review comments
vaidehiadhi e6e1ce4
temp
vaidehiadhi 3e2441f
Merge branch 'development' into surrealdb
Umang01-hash c7de851
add changes to surrealdb
vaidehiadhi 1cd8f96
Merge branch 'surrealdb' of github.com:vaidehiadhi/gofr into surrealdb
vaidehiadhi 3864c4b
minor changes
vaidehiadhi 9b419fb
changes to docs
vaidehiadhi 1761e70
changed delete method
vaidehiadhi 62d7234
resolved review comments
vaidehiadhi 11195b8
review changes
vaidehiadhi c2670a4
Merge branch 'development' into surrealdb
vaidehiadhi 9ed4bbe
fixed logs and docs
vaidehiadhi 203ee3a
Merge branch 'surrealdb' of github.com:vaidehiadhi/gofr into surrealdb
vaidehiadhi 801d4c2
fixed traces and logs
vaidehiadhi 487030d
resolved review comments
vaidehiadhi 1d76fea
Merge branch 'development' into surrealdb
Umang01-hash 1fa45b0
modified docs
vaidehiadhi f0edfe9
Merge branch 'surrealdb' of github.com:vaidehiadhi/gofr into surrealdb
vaidehiadhi ccb6516
Merge branch 'development' into surrealdb
Umang01-hash File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
module gofr.dev/pkg/gofr/datasource/surrealdb | ||
|
||
go 1.22.0 | ||
|
||
toolchain go1.23.4 | ||
|
||
require ( | ||
github.com/stretchr/testify v1.10.0 | ||
github.com/surrealdb/surrealdb.go v0.3.2 | ||
go.opentelemetry.io/otel v1.33.0 | ||
go.opentelemetry.io/otel/trace v1.33.0 | ||
go.uber.org/mock v0.5.0 | ||
) | ||
|
||
require ( | ||
github.com/davecgh/go-spew v1.1.1 // indirect | ||
github.com/fxamacker/cbor/v2 v2.7.0 // indirect | ||
github.com/gofrs/uuid v4.4.0+incompatible // indirect | ||
github.com/gorilla/websocket v1.5.3 // indirect | ||
github.com/pmezard/go-difflib v1.0.0 // indirect | ||
github.com/x448/float16 v0.8.4 // indirect | ||
gopkg.in/yaml.v3 v3.0.1 // indirect | ||
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= | ||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | ||
github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E= | ||
github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ= | ||
github.com/gofrs/uuid v4.4.0+incompatible h1:3qXRTX8/NbyulANqlc0lchS1gqAVxRgsuW1YrTJupqA= | ||
github.com/gofrs/uuid v4.4.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= | ||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= | ||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= | ||
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= | ||
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= | ||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= | ||
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= | ||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= | ||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= | ||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= | ||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= | ||
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= | ||
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= | ||
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= | ||
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= | ||
github.com/surrealdb/surrealdb.go v0.3.2 h1:ynBbD0onW+M4BXhZ1+dDdVnNcaqBqFlHaHCFnk8LgmQ= | ||
github.com/surrealdb/surrealdb.go v0.3.2/go.mod h1:A0zahuChOaJtvTm2lefQnV+6aJtgqNLm9TIdYhZbw1Q= | ||
github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= | ||
github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= | ||
go.opentelemetry.io/otel v1.33.0 h1:/FerN9bax5LoK51X/sI0SVYrjSE0/yUL7DpxW4K3FWw= | ||
go.opentelemetry.io/otel v1.33.0/go.mod h1:SUUkR6csvUQl+yjReHu5uM3EtVV7MBm5FHKRlNx4I8I= | ||
go.opentelemetry.io/otel/trace v1.33.0 h1:cCJuF7LRjUFso9LPnEAHJDB2pqzp+hbO8eu1qqW2d/s= | ||
go.opentelemetry.io/otel/trace v1.33.0/go.mod h1:uIcdVUZMpTAmz0tI1z04GoVSezK37CbGV4fr1f2nBck= | ||
go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU= | ||
go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM= | ||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | ||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= | ||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= | ||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= | ||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package surrealdb | ||
|
||
import ( | ||
"context" | ||
) | ||
|
||
// Logger defines methods for logging debug, log, and error messages. | ||
type Logger interface { | ||
// Debugf logs a formatted debug message. | ||
Debugf(pattern string, args ...any) | ||
// Debug logs a debug message | ||
Debug(args ...any) | ||
// Logf logs a formatted log message. | ||
Logf(pattern string, args ...any) | ||
// Errorf logs a formatted error message | ||
Errorf(pattern string, args ...any) | ||
} | ||
|
||
// Connection defines methods for interacting with a database connection. | ||
type Connection interface { | ||
// Connect establishes a connection to the database. | ||
Connect() error | ||
// Close terminates the database connection. | ||
Close() error | ||
// Send executes a database operation with the given method and parameters. | ||
Send(res any, method string, params ...any) error | ||
// Use sets the active namespace and database for the connection. | ||
Use(namespace string, database string) error | ||
// Let sets a session variable in the connection. | ||
Let(key string, value any) error | ||
// Unset removes a session variable from the connection. | ||
Unset(key string) error | ||
} | ||
|
||
// Metrics provides methods to record and manage application metrics. | ||
type Metrics interface { | ||
// NewCounter creates a new counter metric. | ||
NewCounter(name, desc string) | ||
// NewUpDownCounter creates a new up-down counter metric. | ||
NewUpDownCounter(name, desc string) | ||
// NewHistogram creates a new histogram metric with specified buckets. | ||
NewHistogram(name, desc string, buckets ...float64) | ||
// NewGauge creates a new gauge metric. | ||
NewGauge(name, desc string) | ||
|
||
// IncrementCounter increments a counter by 1. | ||
IncrementCounter(ctx context.Context, name string, labels ...string) | ||
// DeltaUpDownCounter updates a delta for an up-down counter. | ||
DeltaUpDownCounter(ctx context.Context, name string, value float64, labels ...string) | ||
// RecordHistogram records a value in a histogram. | ||
RecordHistogram(ctx context.Context, name string, value float64, labels ...string) | ||
// SetGauge sets the value of a gauge. | ||
SetGauge(name string, value float64, labels ...string) | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.