Skip to content

Commit

Permalink
use falkordb schema in url
Browse files Browse the repository at this point in the history
  • Loading branch information
AviAvni committed Apr 9, 2024
1 parent d5c0c08 commit e3842d7
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions falkordb.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package falkordb
import (
"context"
"errors"
"strings"

"github.com/redis/go-redis/v9"
)
Expand Down Expand Up @@ -57,6 +58,12 @@ func FalkorDBNew(options *ConnectionOption) (*FalkorDB, error) {

// Creates a new FalkorDB instance from a URL.
func FromURL(url string) (*FalkorDB, error) {
if strings.HasPrefix(url, "falkor://") {
url = "redis://" + url[len("falkor://"):]
} else if strings.HasPrefix(url, "falkors://") {
url = "rediss://" + url[len("falkors://"):]
}

options, err := redis.ParseURL(url)
if err != nil {
return nil, err
Expand Down

0 comments on commit e3842d7

Please sign in to comment.