Skip to content

Commit 76ccee4

Browse files
1 parent f71d6d5 commit 76ccee4

File tree

8 files changed

+388
-40
lines changed

8 files changed

+388
-40
lines changed

storage_versioned_docs/version-dynamodb_v2.x.x/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,5 @@ type Storage interface {
7474
- [S3](./s3/README.md) <a href="https://github.com/gofiber/storage/actions?query=workflow%3A%22Tests+S3%22"> <img src="https://img.shields.io/github/actions/workflow/status/gofiber/storage/test-s3.yml?branch=main&label=%F0%9F%A7%AA%20&style=flat&color=75C46B" /> </a>
7575
- [ScyllaDB](./scylladb/README.md) <a href="https://github.com/gofiber/storage/actions?query=workflow%3A%22Tests+scylladb%22"> <img src="https://img.shields.io/github/actions/workflow/status/gofiber/storage/test-scylladb.yml?branch=main&label=%F0%9F%A7%AA%20&style=flat&color=75C46B" /> </a>
7676
- [SQLite3](./sqlite3/README.md) <a href="https://github.com/gofiber/storage/actions?query=workflow%3A%22Tests+Sqlite3%22"> <img src="https://img.shields.io/github/actions/workflow/status/gofiber/storage/test-sqlite3.yml?branch=main&label=%F0%9F%A7%AA%20&style=flat&color=75C46B" /> </a>
77+
- [ClickHouse](./clickhouse/README.md) <a href="https://github.com/gofiber/storage/actions?query=workflow%3A%22Tests+Clickhouse%22"> <img src="https://img.shields.io/github/actions/workflow/status/gofiber/storage/test-clickhouse.yml?branch=main&label=%F0%9F%A7%AA%20&style=flat&color=75C46B" /> </a>
78+
- [Valkey](./valkey/README.md) <a href="https://github.com/gofiber/storage/actions?query=workflow%3A%22Tests+valkey%22"> <img src="https://img.shields.io/github/actions/workflow/status/gofiber/storage/test-valkey.yml?branch=main&label=%F0%9F%A7%AA%20&style=flat&color=75C46B" /> </a>
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
# Clickhouse
2+
3+
A Clickhouse storage driver using [https://github.com/ClickHouse/clickhouse-go](https://github.com/ClickHouse/clickhouse-go).
4+
5+
### Table of Contents
6+
7+
- [Signatures](#signatures)
8+
- [Installation](#installation)
9+
- [Examples](#examples)
10+
- [Config](#config)
11+
- [Default Config](#default-config)
12+
13+
### Signatures
14+
15+
```go
16+
func New(config ...Config) (*Storage, error)
17+
func (s *Storage) Get(key string) ([]byte, error)
18+
func (s *Storage) Set(key string, val []byte, exp time.Duration) error
19+
func (s *Storage) Delete(key string) error
20+
func (s *Storage) Reset() error
21+
func (s *Storage) Close() error
22+
func (s *Storage) Conn() *Session
23+
```
24+
25+
### Installation
26+
27+
Clickhouse is supported on the latest two versions of Go:
28+
29+
Install the clickhouse implementation:
30+
```bash
31+
go get github.com/gofiber/storage/clickhouse
32+
```
33+
34+
### Running the tests
35+
36+
This module uses [Testcontainers for Go](https://github.com/testcontainers/testcontainers-go/) to run integration tests, which will start a local instance of Clickhouse as a Docker container under the hood. To run the tests, you must have Docker (or another container runtime 100% compatible with the Docker APIs) installed on your machine.
37+
38+
### Local development
39+
40+
Before running this implementation, you must ensure a Clickhouse cluster is available.
41+
For local development, we recommend using the Clickhouse Docker image; it contains everything
42+
necessary for the client to operate correctly.
43+
44+
To start Clickhouse using Docker, issue the following:
45+
46+
```bash
47+
docker run -d -p 9000:9000 --name some-clickhouse-server --ulimit nofile=262144:262144 clickhouse/clickhouse-server
48+
```
49+
50+
After running this command you're ready to start using the storage and connecting to the database.
51+
52+
### Examples
53+
54+
You can use the following options to create a clickhouse storage driver:
55+
```go
56+
import "github.com/gofiber/storage/clickhouse"
57+
58+
// Initialize default config, to connect to localhost:9000 using the memory engine and with a clean table.
59+
store, err := clickhouse.New(clickhouse.Config{
60+
Host: "localhost",
61+
Port: 9000,
62+
Clean: true,
63+
})
64+
65+
// Initialize custom config to connect to a different host/port and use custom engine and with clean table.
66+
store, err := clickhouse.New(clickhouse.Config{
67+
Host: "some-ip-address",
68+
Port: 9000,
69+
Engine: clickhouse.MergeTree,
70+
Clean: true,
71+
})
72+
73+
// Initialize to connect with TLS enabled with your own tls.Config and with clean table.
74+
tlsConfig := config := &tls.Config{...}
75+
76+
store, err := clickhouse.New(clickhouse.Config{
77+
Host: "some-ip-address",
78+
Port: 9000,
79+
Clean: true,
80+
TLSConfig: tlsConfig,
81+
})
82+
```
83+
84+
### Config
85+
86+
```go
87+
// Config defines configuration options for Clickhouse connection.
88+
type Config struct {
89+
// The host of the database. Ex: 127.0.0.1
90+
Host string
91+
// The port where the database is supposed to listen to. Ex: 9000
92+
Port int
93+
// The database that the connection should authenticate from
94+
Database string
95+
// The username to be used in the authentication
96+
Username string
97+
// The password to be used in the authentication
98+
Password string
99+
// The name of the table that will store the data
100+
Table string
101+
// The engine that should be used in the table
102+
Engine string
103+
// Should start a clean table, default false
104+
Clean bool
105+
// TLS configuration, default nil
106+
TLSConfig *tls.Config
107+
// Should the connection be in debug mode, default false
108+
Debug bool
109+
// The function to use with the debug config, default print function. It only works when debug is true
110+
Debugf func(format string, v ...any)
111+
}
112+
```
113+
114+
### Default Config
115+
116+
```go
117+
var DefaultConfig = Config{
118+
Host: "localhost",
119+
Port: 9000,
120+
Engine: "Memory",
121+
Clean: false,
122+
}
123+
```

storage_versioned_docs/version-dynamodb_v2.x.x/coherence/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Coherence
2-
<!-- Copyright © 2023, Oracle and/or its affiliates. -->
2+
<!-- Copyright © 2023, 2025 Oracle and/or its affiliates. -->
33
A Coherence storage driver using [https://github.com/oracle/coherence-go-client](https://github.com/oracle/coherence-go-client).
44

55
### Table of Contents
@@ -35,10 +35,10 @@ necessary for the client to operate correctly.
3535
To start a Coherence cluster using Docker, issue the following:
3636

3737
```bash
38-
docker run -d -p 1408:1408 ghcr.io/oracle/coherence-ce:22.06.7
38+
docker run -d -p 1408:1408 ghcr.io/oracle/coherence-ce:24.09
3939
```
4040

41-
See the documentation [here](https://pkg.go.dev/github.com/oracle/coherence-go-client/coherence#hdr-Obtaining_a_Session) on connection options
41+
See the documentation [here](https://pkg.go.dev/github.com/oracle/coherence-go-client/[email protected]/coherence#hdr-Obtaining_a_Session) on connection options
4242
when creating a Coherence session.
4343

4444
### Examples

storage_versioned_docs/version-dynamodb_v2.x.x/minio/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ type Config struct {
9494
// Optional. Default is false
9595
Reset bool
9696

97+
// The maximum number of times requests that encounter retryable failures should be attempted.
98+
// Optional. Default is 10, same as the MinIO client.
99+
MaxRetry int
100+
97101
// Credentials Minio access key and Minio secret key.
98102
// Need to be defined
99103
Credentials Credentials
@@ -124,6 +128,7 @@ var ConfigDefault = Config{
124128
Token: "",
125129
Secure: false,
126130
Reset: false,
131+
127132
Credentials: Credentials{},
128133
GetObjectOptions: minio.GetObjectOptions{},
129134
PutObjectOptions: minio.PutObjectOptions{},

storage_versioned_docs/version-dynamodb_v2.x.x/nats/README.md

Lines changed: 31 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ title: Nats
1212

1313
A NATS Key/Value storage driver.
1414

15-
**Note: Requires Go 1.20 and above**
15+
## Note: Requires Go 1.20 and above
1616

1717
### Table of Contents
1818

@@ -57,60 +57,56 @@ Import the storage package.
5757
import "github.com/gofiber/storage/nats"
5858
```
5959

60-
You can use the following possibilities to create a storage:
60+
You can use the following options to create a storage driver:
6161

6262
```go
6363
// Initialize default config
6464
store := nats.New()
6565

6666
// Initialize custom config
6767
store := nats.New(Config{
68-
URLs: "nats://127.0.0.1:4443",
69-
NatsOptions: []nats.Option{
70-
nats.MaxReconnects(2),
71-
// Enable TLS by specifying RootCAs
72-
nats.RootCAs("./testdata/certs/ca.pem"),
73-
},
74-
KeyValueConfig: jetstream.KeyValueConfig{
75-
Bucket: "test",
76-
Storage: jetstream.MemoryStorage,
77-
},
68+
URLs: "nats://127.0.0.1:4443",
69+
NatsOptions: []nats.Option{
70+
nats.MaxReconnects(2),
71+
// Enable TLS by specifying RootCAs
72+
nats.RootCAs("./testdata/certs/ca.pem"),
73+
},
74+
KeyValueConfig: jetstream.KeyValueConfig{
75+
Bucket: "test",
76+
Storage: jetstream.MemoryStorage,
77+
},
7878
})
7979
```
8080

8181
### Config
8282

8383
```go
8484
type Config struct {
85-
// Nats URLs, default "nats://127.0.0.1:4222". Can be comma separated list for multiple servers
86-
URLs string
87-
// Nats connection options. See nats_test.go for an example of how to use this.
88-
NatsOptions []nats.Option
89-
// Nats connection name
90-
ClientName string
91-
// Nats context
92-
Context context.Context
93-
// Nats key value config
94-
KeyValueConfig jetstream.KeyValueConfig
95-
// Logger. Using Fiber AllLogger interface for adapting the various log libraries.
96-
Logger log.AllLogger
97-
// Use the Logger for nats events, default: false
98-
Verbose bool
99-
// Wait for connection to be established, default: 100ms
100-
WaitForConnection time.Duration
85+
// Nats URLs, default "nats://127.0.0.1:4222". Can be comma separated list for multiple servers
86+
URLs string
87+
// Nats connection options. See nats_test.go for an example of how to use this.
88+
NatsOptions []nats.Option
89+
// Nats connection name
90+
ClientName string
91+
// Nats context
92+
Context context.Context
93+
// Nats key value config
94+
KeyValueConfig jetstream.KeyValueConfig
95+
// Wait for connection to be established, default: 100ms
96+
WaitForConnection time.Duration
10197
}
10298
```
10399

104100
### Default Config
105101

106102
```go
107103
var ConfigDefault = Config{
108-
URLs: nats.DefaultURL,
109-
Context: context.Background(),
110-
ClientName: "fiber_storage",
111-
KeyValueConfig: jetstream.KeyValueConfig{
112-
Bucket: "fiber_storage",
113-
},
114-
WaitForConnection: 100 * time.Millisecond,
104+
URLs: nats.DefaultURL,
105+
Context: context.Background(),
106+
ClientName: "fiber_storage",
107+
KeyValueConfig: jetstream.KeyValueConfig{
108+
Bucket: "fiber_storage",
109+
},
110+
WaitForConnection: 100 * time.Millisecond,
115111
}
116112
```

storage_versioned_docs/version-dynamodb_v2.x.x/postgres/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ title: Postgres
1111

1212
A Postgres storage driver using [jackc/pgx](https://github.com/jackc/pgx).
1313

14-
**Note: Requires Go 1.19 and above**
14+
**Note: Requires Go 1.20 and above**
1515

1616
### Table of Contents
1717
- [Signatures](#signatures)

0 commit comments

Comments
 (0)