-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sync docs for release https://github.com/gofiber/storage/releases/tag…
- Loading branch information
1 parent
4803f74
commit 07c24dd
Showing
11 changed files
with
676 additions
and
40 deletions.
There are no files selected for viewing
This file contains 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
123 changes: 123 additions & 0 deletions
123
storage_versioned_docs/version-postgres_v3.x.x/clickhouse/README.md
This file contains 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,123 @@ | ||
# Clickhouse | ||
|
||
A Clickhouse storage driver using [https://github.com/ClickHouse/clickhouse-go](https://github.com/ClickHouse/clickhouse-go). | ||
|
||
### Table of Contents | ||
|
||
- [Signatures](#signatures) | ||
- [Installation](#installation) | ||
- [Examples](#examples) | ||
- [Config](#config) | ||
- [Default Config](#default-config) | ||
|
||
### Signatures | ||
|
||
```go | ||
func New(config ...Config) (*Storage, error) | ||
func (s *Storage) Get(key string) ([]byte, error) | ||
func (s *Storage) Set(key string, val []byte, exp time.Duration) error | ||
func (s *Storage) Delete(key string) error | ||
func (s *Storage) Reset() error | ||
func (s *Storage) Close() error | ||
func (s *Storage) Conn() *Session | ||
``` | ||
|
||
### Installation | ||
|
||
Clickhouse is supported on the latest two versions of Go: | ||
|
||
Install the clickhouse implementation: | ||
```bash | ||
go get github.com/gofiber/storage/clickhouse | ||
``` | ||
|
||
### Running the tests | ||
|
||
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. | ||
|
||
### Local development | ||
|
||
Before running this implementation, you must ensure a Clickhouse cluster is available. | ||
For local development, we recommend using the Clickhouse Docker image; it contains everything | ||
necessary for the client to operate correctly. | ||
|
||
To start Clickhouse using Docker, issue the following: | ||
|
||
```bash | ||
docker run -d -p 9000:9000 --name some-clickhouse-server --ulimit nofile=262144:262144 clickhouse/clickhouse-server | ||
``` | ||
|
||
After running this command you're ready to start using the storage and connecting to the database. | ||
|
||
### Examples | ||
|
||
You can use the following options to create a clickhouse storage driver: | ||
```go | ||
import "github.com/gofiber/storage/clickhouse" | ||
|
||
// Initialize default config, to connect to localhost:9000 using the memory engine and with a clean table. | ||
store, err := clickhouse.New(clickhouse.Config{ | ||
Host: "localhost", | ||
Port: 9000, | ||
Clean: true, | ||
}) | ||
|
||
// Initialize custom config to connect to a different host/port and use custom engine and with clean table. | ||
store, err := clickhouse.New(clickhouse.Config{ | ||
Host: "some-ip-address", | ||
Port: 9000, | ||
Engine: clickhouse.MergeTree, | ||
Clean: true, | ||
}) | ||
|
||
// Initialize to connect with TLS enabled with your own tls.Config and with clean table. | ||
tlsConfig := config := &tls.Config{...} | ||
|
||
store, err := clickhouse.New(clickhouse.Config{ | ||
Host: "some-ip-address", | ||
Port: 9000, | ||
Clean: true, | ||
TLSConfig: tlsConfig, | ||
}) | ||
``` | ||
|
||
### Config | ||
|
||
```go | ||
// Config defines configuration options for Clickhouse connection. | ||
type Config struct { | ||
// The host of the database. Ex: 127.0.0.1 | ||
Host string | ||
// The port where the database is supposed to listen to. Ex: 9000 | ||
Port int | ||
// The database that the connection should authenticate from | ||
Database string | ||
// The username to be used in the authentication | ||
Username string | ||
// The password to be used in the authentication | ||
Password string | ||
// The name of the table that will store the data | ||
Table string | ||
// The engine that should be used in the table | ||
Engine string | ||
// Should start a clean table, default false | ||
Clean bool | ||
// TLS configuration, default nil | ||
TLSConfig *tls.Config | ||
// Should the connection be in debug mode, default false | ||
Debug bool | ||
// The function to use with the debug config, default print function. It only works when debug is true | ||
Debugf func(format string, v ...any) | ||
} | ||
``` | ||
|
||
### Default Config | ||
|
||
```go | ||
var DefaultConfig = Config{ | ||
Host: "localhost", | ||
Port: 9000, | ||
Engine: "Memory", | ||
Clean: false, | ||
} | ||
``` |
114 changes: 114 additions & 0 deletions
114
storage_versioned_docs/version-postgres_v3.x.x/cloudflarekv/README.md
This file contains 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,114 @@ | ||
--- | ||
id: cloudflarekv | ||
title: Cloudflare KV | ||
--- | ||
|
||
![Release](https://img.shields.io/github/v/tag/gofiber/storage?filter=cloudflarekv*) | ||
[![Discord](https://img.shields.io/discord/704680098577514527?style=flat&label=%F0%9F%92%AC%20discord&color=00ACD7)](https://gofiber.io/discord) | ||
![Test](https://img.shields.io/github/actions/workflow/status/gofiber/storage/test-cloudflarekv.yml?label=Tests) | ||
![Security](https://img.shields.io/github/actions/workflow/status/gofiber/storage/gosec.yml?label=Security) | ||
![Linter](https://img.shields.io/github/actions/workflow/status/gofiber/storage/linter.yml?label=Linter) | ||
|
||
A Cloudflare KV storage driver using [cloudflare/cloudflare-go](https://github.com/cloudflare/cloudflare-go). | ||
|
||
**Note: Requires Go 1.21 and above** | ||
|
||
### Table of Contents | ||
|
||
- [Signatures](#signatures) | ||
- [Installation](#installation) | ||
- [Examples](#examples) | ||
- [Config](#config) | ||
- [Default Config](#default-config) | ||
|
||
### Signatures | ||
|
||
```go | ||
func New(config ...Config) Storage | ||
func (s *Storage) Get(key string) ([]byte, error) | ||
func (s *Storage) Set(key string, val []byte, exp time.Duration) error | ||
func (s *Storage) Delete(key string) error | ||
func (s *Storage) Reset() error | ||
func (s *Storage) Close() error | ||
func (s *Storage) Conn() *cloudflare.API | ||
``` | ||
|
||
### Installation | ||
|
||
```bash | ||
go mod init github.com/<user>/<repo> | ||
``` | ||
|
||
And then install the Cloudflare KV implementation: | ||
|
||
```bash | ||
go get github.com/gofiber/storage/cloudflarekv | ||
``` | ||
|
||
### Examples | ||
|
||
Import the storage package. | ||
|
||
```go | ||
import "github.com/gofiber/storage/cloudflarekv" | ||
``` | ||
|
||
You can use the following methods to create storage. The Key must be an API Token generated with at least `Account.Workers KV Storage` permission. Check the [Create API Token](https://developers.cloudflare.com/fundamentals/api/get-started/create-token/) documentation to generate one. | ||
|
||
```go | ||
// Initialize default config | ||
store := cloudflarekv.New() | ||
|
||
store := cloudflarekv.New(cloudflarekv.Config{ | ||
Key: "", | ||
Email: "", | ||
AccountID: "fiber", | ||
NamespaceID: "fiber", | ||
Reset: false, | ||
}) | ||
|
||
``` | ||
|
||
### Config | ||
|
||
```go | ||
type Config struct { | ||
|
||
// Cloudflare Auth Token | ||
// | ||
// Optional. Default is "" | ||
Key string | ||
|
||
// Cloudflare Email | ||
// | ||
// Optional. Default is "" | ||
Email string | ||
|
||
// Account id | ||
// | ||
// Optional. Default is "fiber" | ||
AccountID string | ||
|
||
// Namespace id | ||
// | ||
// Optional. Default is "fiber" | ||
NamespaceID string | ||
|
||
// Reset clears any existing keys in existing Table | ||
// | ||
// Optional. Default is false | ||
Reset bool | ||
} | ||
``` | ||
|
||
### Default Config | ||
|
||
```go | ||
var ConfigDefault = Config{ | ||
Key: "", | ||
Email: "", | ||
AccountID: "fiber", | ||
NamespaceID: "fiber", | ||
Reset: false, | ||
} | ||
``` |
This file contains 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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# Coherence | ||
<!-- Copyright © 2023, Oracle and/or its affiliates. --> | ||
<!-- Copyright © 2023, 2025 Oracle and/or its affiliates. --> | ||
A Coherence storage driver using [https://github.com/oracle/coherence-go-client](https://github.com/oracle/coherence-go-client). | ||
|
||
### Table of Contents | ||
|
@@ -35,10 +35,10 @@ necessary for the client to operate correctly. | |
To start a Coherence cluster using Docker, issue the following: | ||
|
||
```bash | ||
docker run -d -p 1408:1408 ghcr.io/oracle/coherence-ce:22.06.7 | ||
docker run -d -p 1408:1408 ghcr.io/oracle/coherence-ce:24.09 | ||
``` | ||
|
||
See the documentation [here](https://pkg.go.dev/github.com/oracle/coherence-go-client/coherence#hdr-Obtaining_a_Session) on connection options | ||
See the documentation [here](https://pkg.go.dev/github.com/oracle/coherence-go-client/[email protected]/coherence#hdr-Obtaining_a_Session) on connection options | ||
when creating a Coherence session. | ||
|
||
### Examples | ||
|
This file contains 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
Oops, something went wrong.