-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
56d6ef3
commit c2949bd
Showing
7 changed files
with
40 additions
and
32 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,10 +2,10 @@ | |
|
||
A simple Redis client in tune with Functional Programming principles in JavaScript for Deno. | ||
|
||
[](https://deno.land/x/[email protected].0) | ||
[](https://deno.land/x/[email protected].1) | ||
[](https://github.com/denoland/deno) | ||
[](https://github.com/sebastienfilion/functional-redis/releases) | ||
[](https://github.com/sebastienfilion/functional-redis/blob/v0.1.0/LICENSE) | ||
[](https://github.com/sebastienfilion/functional-redis/blob/v0.1.1/LICENSE) | ||
|
||
* [Redis Request](#redis-request) | ||
|
||
|
@@ -19,13 +19,15 @@ The `RedisRequest` type is mostly interoperable with [`Resource`](https://github | |
and [`(HTTP) Response`](https://github.com/sebastienfilion/functional-io#response). | ||
|
||
The `RedisRequest` type implements the following algebras: | ||
- [x] Group | ||
- [x] Comonad | ||
- [x] Monad | ||
- [x] Group | ||
- [x] Comonad | ||
- [x] Monad | ||
|
||
### Example | ||
|
||
```js | ||
import RedisRequest from "https://deno.land/x/[email protected]/library/RedisRequest.js"; | ||
|
||
const redisRequest = RedisRequest("GET", new Uint8Array([]), [ "hoge" ]); | ||
|
||
assert(RedisRequest.is(redisRequest)); | ||
|
@@ -35,8 +37,9 @@ A Symbol named `rawPlaceholder` may be used as a placeholder for the buffer. | |
In the following example, the request will resolve to: `SET hoge piyo`. | ||
|
||
```js | ||
import { encodeText } from "https://deno.land/x/[email protected]/library/utilities.js"; | ||
import { $$rawPlaceholder } from "https://deno.land/x/[email protected]/library/Symbol.js"; | ||
import { encodeText } from "https://deno.land/x/[email protected]/library/utilities.js"; | ||
import RedisRequest from "https://deno.land/x/[email protected]/library/RedisRequest.js"; | ||
import { $$rawPlaceholder } from "https://deno.land/x/[email protected]/library/Symbol.js"; | ||
|
||
const redisRequest = RedisRequest("SET", encodeText("piyo"), [ "hoge", $$rawPlaceholder ]); | ||
|
||
|
@@ -46,8 +49,9 @@ assert(RedisRequest.is(redisRequest)); | |
The placeholder can be used multiple times if the buffer has multiple values separated by CLRF (`\r\n`). | ||
|
||
```js | ||
import { encodeText } from "https://deno.land/x/[email protected]/library/utilities.js"; | ||
import { $$rawPlaceholder } from "https://deno.land/x/[email protected]/library/Symbol.js"; | ||
import { encodeText } from "https://deno.land/x/[email protected]/library/utilities.js"; | ||
import RedisRequest from "https://deno.land/x/[email protected]/library/RedisRequest.js"; | ||
import { $$rawPlaceholder } from "https://deno.land/x/[email protected]/library/Symbol.js"; | ||
|
||
const redisRequest = RedisRequest( | ||
"MSET", | ||
|
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 |
---|---|---|
|
@@ -8,14 +8,14 @@ import { | |
toPairs, | ||
when | ||
} from "https://x.nest.land/[email protected]/source/index.js"; | ||
import { factorizeType } from "https://deno.land/x/functional@v1.0.0/library/factories.js"; | ||
import { factorizeType } from "https://deno.land/x/functional@v1.2.1/library/factories.js"; | ||
import { $$rawPlaceholder } from "./Symbol.js"; | ||
import { | ||
assertIsArray, | ||
assertIsBoolean, | ||
assertIsInstance, | ||
assertIsString | ||
} from "../../functional/library/utilities.js"; | ||
} from "https://deno.land/x/functional@v1.2.1/library/utilities.js"; | ||
|
||
export const RedisRequest = factorizeType("RedisRequest", [ "command", "raw", "arguments" ]); | ||
|
||
|
@@ -35,6 +35,8 @@ export const RedisRequest = factorizeType("RedisRequest", [ "command", "raw", "a | |
* ### Example | ||
* | ||
* ```js | ||
* import RedisRequest from "https://deno.land/x/[email protected]/library/RedisRequest.js"; | ||
* | ||
* const redisRequest = RedisRequest("GET", new Uint8Array([]), [ "hoge" ]); | ||
* | ||
* assert(RedisRequest.is(redisRequest)); | ||
|
@@ -44,7 +46,8 @@ export const RedisRequest = factorizeType("RedisRequest", [ "command", "raw", "a | |
* In the following example, the request will resolve to: `SET hoge piyo`. | ||
* | ||
* ```js | ||
* import { encodeText } from "https://deno.land/x/[email protected]/library/utilities.js"; | ||
* import { encodeText } from "https://deno.land/x/[email protected]/library/utilities.js"; | ||
* import RedisRequest from "https://deno.land/x/[email protected]/library/RedisRequest.js"; | ||
* import { $$rawPlaceholder } from "https://deno.land/x/[email protected]/library/Symbol.js"; | ||
* | ||
* const redisRequest = RedisRequest("SET", encodeText("piyo"), [ "hoge", $$rawPlaceholder ]); | ||
|
@@ -55,7 +58,8 @@ export const RedisRequest = factorizeType("RedisRequest", [ "command", "raw", "a | |
* The placeholder can be used multiple times if the buffer has multiple values separated by CLRF (`\r\n`). | ||
* | ||
* ```js | ||
* import { encodeText } from "https://deno.land/x/[email protected]/library/utilities.js"; | ||
* import { encodeText } from "https://deno.land/x/[email protected]/library/utilities.js"; | ||
* import RedisRequest from "https://deno.land/x/[email protected]/library/RedisRequest.js"; | ||
* import { $$rawPlaceholder } from "https://deno.land/x/[email protected]/library/Symbol.js"; | ||
* | ||
* const redisRequest = RedisRequest( | ||
|
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
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,6 +1,6 @@ | ||
import { curry } from "https://x.nest.land/[email protected]/source/index.js"; | ||
import { factorizeSumType } from "https://deno.land/x/functional@v1.0.0/library/factories.js"; | ||
import { $$tag, $$type } from "https://deno.land/x/functional@v1.0.0/library/Symbols.js"; | ||
import { factorizeSumType } from "https://deno.land/x/functional@v1.2.1/library/factories.js"; | ||
import { $$tag, $$type } from "https://deno.land/x/functional@v1.2.1/library/Symbols.js"; | ||
|
||
export const RedisResponse = factorizeSumType( | ||
"RedisResponse", | ||
|
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 |
---|---|---|
|
@@ -27,19 +27,19 @@ import { | |
when | ||
} from "https://x.nest.land/[email protected]/source/index.js"; | ||
|
||
import Pair from "../../functional/library/Pair.js"; | ||
import Task from "../../functional/library/Task.js"; | ||
import { decodeRaw, encodeText, runSequentially } from "../../functional/library/utilities.js"; | ||
import { factorizeBuffer } from "../../functional-io/library/Buffer.js"; | ||
import Resource, { factorizeResource } from "../../functional-io/library/Resource.js"; | ||
import { close, readLine, readNBytes, write } from "../../functional-io/library/fs.js"; | ||
import Pair from "https://deno.land/x/functional@v1.2.1/library/Pair.js"; | ||
import Task from "https://deno.land/x/functional@v1.2.1/library/Task.js"; | ||
import { decodeRaw, encodeText, runSequentially } from "https://deno.land/x/functional@v1.2.1/library/utilities.js"; | ||
import { factorizeBuffer } from "https://deno.land/x/[email protected]//library/Buffer.js"; | ||
import Resource, { factorizeResource } from "https://deno.land/x/[email protected]//library/Resource.js"; | ||
import { close, readLine, readNBytes, write } from "https://deno.land/x/[email protected]//library/fs.js"; | ||
import { | ||
discardFirstLine, | ||
discardNCharacter, | ||
factorizeUint8Array, | ||
splitCLRF, | ||
trimCRLF | ||
} from "../../functional-io/library/utilities.js"; | ||
} from "https://deno.land/x/[email protected]//library/utilities.js"; | ||
import { factorizeRedisResponseFailure, factorizeRedisResponseSuccess } from "./RedisResponse.js"; | ||
import { $$rawPlaceholder } from "./Symbol.js"; | ||
import RedisRequest, { factorizeRedisRequest } from "./RedisRequest.js"; | ||
|
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,16 +1,16 @@ | ||
import { assert, assertEquals } from "https://deno.land/std@0.70.0/testing/asserts.ts" | ||
import { assert, assertEquals } from "https://deno.land/std@0.79.0/testing/asserts.ts" | ||
import { compose, map, tap } from "https://x.nest.land/[email protected]/source/index.js"; | ||
|
||
import Task from "https://deno.land/x/functional@v1.1.0/library/Task.js"; | ||
import Task from "https://deno.land/x/functional@v1.2.1/library/Task.js"; | ||
import { | ||
decodeRaw, | ||
encodeText, | ||
insideOut, | ||
log, | ||
safeExtract | ||
} from "https://deno.land/x/functional@v1.1.0/library/utilities.js"; | ||
import Buffer from "../../functional-io/library/Buffer.js"; | ||
import Resource from "../../functional-io/library/Resource.js"; | ||
} from "https://deno.land/x/functional@v1.2.1/library/utilities.js"; | ||
import Buffer from "https://deno.land/x/[email protected]/library/Buffer.js"; | ||
import Resource from "https://deno.land/x/[email protected]/library/Resource.js"; | ||
|
||
import RedisRequest from "./RedisRequest.js"; | ||
import { $$rawPlaceholder } from "./Symbol.js"; | ||
|
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,10 +1,10 @@ | ||
import { chain, compose, converge, curry, map, reduce } from "https://x.nest.land/[email protected]/source/index.js"; | ||
import { connect } from "https://deno.land/x/redis/mod.ts"; | ||
|
||
import Pair from "../../functional/library/Pair.js"; | ||
import Task from "../../functional/library/Task.js"; | ||
import Pair from "https://deno.land/x/functional@v1.2.1/library/Pair.js"; | ||
import Task from "https://deno.land/x/functional@v1.2.1/library/Task.js"; | ||
|
||
import { log, runSequentially, safeExtract } from "../../functional/library/utilities.js"; | ||
import { log, runSequentially, safeExtract } from "https://deno.land/x/functional@v1.2.1/library/utilities.js"; | ||
|
||
import { connectRedisClient, disconnectRedisClient, executeRedisCommand, executeSimpleRedisCommand } from "./client.js"; | ||
import RedisRequest from "./RedisRequest.js"; | ||
|