mirror of
https://github.com/gofiber/storage.git
synced 2025-09-29 13:52:20 +08:00
Compare commits
8 Commits
valkey/v0.
...
v3
Author | SHA1 | Date | |
---|---|---|---|
![]() |
fb997fd4b5 | ||
![]() |
40f3844551 | ||
![]() |
1b4c2425db | ||
![]() |
d8b1437f50 | ||
![]() |
b5d51650a3 | ||
![]() |
863ef71f8b | ||
![]() |
f2a5ba2e7c | ||
![]() |
85b4a99042 |
@@ -3,9 +3,15 @@ id: neo4j
|
|||||||
title: Neo4j
|
title: Neo4j
|
||||||
---
|
---
|
||||||
|
|
||||||
|

|
||||||
|
[](https://gofiber.io/discord)
|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|
|
||||||
A Neo4j storage driver using [neo4j/neo4j-go-driver](https://github.com/neo4j/neo4j-go-driver).
|
A Neo4j storage driver using [neo4j/neo4j-go-driver](https://github.com/neo4j/neo4j-go-driver).
|
||||||
|
|
||||||
> **Note: Requires latest two release of Golang**
|
> **Note: Requires latest two releases of Golang**
|
||||||
|
|
||||||
### Table of Contents
|
### Table of Contents
|
||||||
|
|
||||||
@@ -18,7 +24,7 @@ A Neo4j storage driver using [neo4j/neo4j-go-driver](https://github.com/neo4j/ne
|
|||||||
### Signatures
|
### Signatures
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func New(config ...Config) Storage
|
func New(config ...Config) *Storage
|
||||||
func (s *Storage) Get(key string) ([]byte, error)
|
func (s *Storage) Get(key string) ([]byte, error)
|
||||||
func (s *Storage) Set(key string, val []byte, exp time.Duration) error
|
func (s *Storage) Set(key string, val []byte, exp time.Duration) error
|
||||||
func (s *Storage) Delete(key string) error
|
func (s *Storage) Delete(key string) error
|
||||||
@@ -46,17 +52,19 @@ go get github.com/gofiber/storage/neo4j
|
|||||||
Import the storage package.
|
Import the storage package.
|
||||||
|
|
||||||
```go
|
```go
|
||||||
import neo4jstore "github.com/gofiber/storage/neo4j"
|
import "github.com/gofiber/storage/neo4j"
|
||||||
```
|
```
|
||||||
|
|
||||||
You can use the following possibilities to create a storage:
|
You can use the following possibilities to create a storage:
|
||||||
|
|
||||||
|
> The `neo4j` package name used in this example is the package name (and default import name) for this storage driver. Feel free import it with a custom name to avoid confusing it with the neo4j-go-driver package which also uses `neo4j` as package name (and default import name).
|
||||||
|
|
||||||
```go
|
```go
|
||||||
// Initialize default config
|
// Initialize default config
|
||||||
store := neo4j.New()
|
store := neo4j.New()
|
||||||
|
|
||||||
// Initialize custom config
|
// Initialize custom config
|
||||||
store := neo4j.New(neo4jstore.Config{
|
store := neo4j.New(neo4j.Config{
|
||||||
DB: driver,
|
DB: driver,
|
||||||
Node: "fiber_storage",
|
Node: "fiber_storage",
|
||||||
Reset: false,
|
Reset: false,
|
||||||
@@ -66,12 +74,14 @@ store := neo4j.New(neo4jstore.Config{
|
|||||||
|
|
||||||
### Config
|
### Config
|
||||||
|
|
||||||
|
> The `neo4j`, `auth`, and `config` package names used here belong to the neo4j-go-driver package.
|
||||||
|
|
||||||
```go
|
```go
|
||||||
// Config defines the config for storage.
|
// Config defines the config for storage.
|
||||||
type Config struct {
|
type Config struct {
|
||||||
// Connection pool
|
// Connection pool
|
||||||
//
|
//
|
||||||
// DB neo4j.DriverWithContext object will override connection uri and other connection fields.
|
// DB neo4j.DriverWithContext object will override connection URI and other connection fields.
|
||||||
//
|
//
|
||||||
// Optional. Default is nil.
|
// Optional. Default is nil.
|
||||||
DB neo4j.DriverWithContext
|
DB neo4j.DriverWithContext
|
||||||
@@ -108,12 +118,12 @@ type Config struct {
|
|||||||
// Optional. Default is "fiber_storage"
|
// Optional. Default is "fiber_storage"
|
||||||
Node string
|
Node string
|
||||||
|
|
||||||
// Reset clears any existing keys in existing Table
|
// Reset clears any existing keys (Nodes)
|
||||||
//
|
//
|
||||||
// Optional. Default is false
|
// Optional. Default is false
|
||||||
Reset bool
|
Reset bool
|
||||||
|
|
||||||
// Time before deleting expired keys
|
// Time before deleting expired keys (Nodes)
|
||||||
//
|
//
|
||||||
// Optional. Default is 10 * time.Second
|
// Optional. Default is 10 * time.Second
|
||||||
GCInterval time.Duration
|
GCInterval time.Duration
|
||||||
|
Reference in New Issue
Block a user