Skip to content

Commit

Permalink
Embedded engine implementation (#161)
Browse files Browse the repository at this point in the history
Co-authored-by: Tobie Morgan Hitchcock <[email protected]>
  • Loading branch information
remade and tobiemh authored Nov 22, 2024
1 parent fffe8a0 commit 70c34f0
Show file tree
Hide file tree
Showing 13 changed files with 693 additions and 17 deletions.
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ linters-settings:
- ifElseChain
- octalLiteral
- whyNoLint
- dupSubExpr # https://github.com/go-critic/go-critic/issues/897#issuecomment-568896534
gocyclo:
min-complexity: 15
goimports:
Expand Down
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,20 @@ or for a secure connection
db, err := surrealdb.New("https://localhost:8000")
```

### Using SurrealKV and Memory
SurrealKV and Memory also do not support live notifications at this time. This would be updated in the next
release.

For Surreal KV
```go
db, err := surrealdb.New("surrealkv://path/to/dbfile.kv")
```

For Memory
```go
db, err := surrealdb.New("mem://")
db, err := surrealdb.New("memory://")
```

## Data Models
This package facilitates communication between client and the backend service using the Concise
Expand Down
2 changes: 2 additions & 0 deletions db.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ func New(connectionURL string) (*DB, error) {
con = connection.NewHTTPConnection(newParams)
} else if scheme == "ws" || scheme == "wss" {
con = connection.NewWebSocketConnection(newParams)
} else if scheme == "memory" || scheme == "mem" || scheme == "surrealkv" {
con = connection.NewEmbeddedConnection(newParams)
} else {
return nil, fmt.Errorf("invalid connection url")
}
Expand Down
3 changes: 2 additions & 1 deletion db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import (
"testing"
"time"

"github.com/stretchr/testify/suite"
"github.com/surrealdb/surrealdb.go"

"github.com/stretchr/testify/suite"
"github.com/surrealdb/surrealdb.go/pkg/connection"
"github.com/surrealdb/surrealdb.go/pkg/models"
)
Expand Down
Binary file added libsrc/libsurrealdb_c.dylib
Binary file not shown.
Loading

0 comments on commit 70c34f0

Please sign in to comment.