Skip to content

Commit

Permalink
moar doc updates
Browse files Browse the repository at this point in the history
  • Loading branch information
guyroyse committed Oct 29, 2021
1 parent b9319e2 commit 8f6d2ee
Show file tree
Hide file tree
Showing 24 changed files with 365 additions and 380 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Excellent. Set up done. Let's write some code!

# Connect to Redis with a Client

You connect to Redis using a [*client*](docs/client.md). The `Client` class has methods to open, close, and excute raw commands against Redis.
You connect to Redis using a [*client*](docs/classes/Client.md). The `Client` class has methods to open, close, and excute raw commands against Redis.

```javascript
let { Client } = require('redis-om')
Expand Down Expand Up @@ -149,19 +149,19 @@ If you don't provide a URL, it defaults to `redis://localhost:6379`.

# Define an Entity and a Schema

Ok. Let's start doing some object mapping. We'll start by defining an [*entity*](docs/entity.md) and a [*schema*](docs/schema.md).
Ok. Let's start doing some object mapping. We'll start by defining an [*entity*](docs/classes/Entity.md) and a [*schema*](docs/classes/Schema.md).

```javascript
import { Entity, Schema } from 'redis-om'
```

[Entities](docs/entity.md) are the classes that you work with. The thing being created, read, updated, and deleted. Any class that extends `Entity` is an entity. Usually, you'll define an entity with a single line of code:
[Entities](docs/classes/Entity.md) are the classes that you work with. The thing being created, read, updated, and deleted. Any class that extends `Entity` is an entity. Usually, you'll define an entity with a single line of code:

```javascript
class Album extends Entity {}
```

[Schemas](docs/schema.md) define the fields on your entity, their types, and how they are mapped internally to Redis. By default, entities map to Hashes in Redis but you can also use JSON, more on that later.:
[Schemas](docs/classes/Schema.md) define the fields on your entity, their types, and how they are mapped internally to Redis. By default, entities map to Hashes in Redis but you can also use JSON, more on that later.:

```javascript
let schema = new Schema(Album, {
Expand All @@ -175,11 +175,11 @@ let schema = new Schema(Album, {

When you create a `Schema`, it modifies the entity you handed it, adding getters and setters for the properties you define. The type those getters and setters accept and return are defined with the type parameter above. Valid values are: `string`, `number`, `boolean`, or `array`. The first three do exactly waht you think they do—they define a property that is a String, Number, or Boolean. `array` specifically defines an array of Strings.

There are several other options available when defining a schema for your entity. Check them out in the [detailed documentation](docs/schema.md) for the `Schema` class.
There are several other options available when defining a schema for your entity. Check them out in the [detailed documentation](docs/classes/Schema.md) for the `Schema` class.

# Reading and Writing with Repository

Now that we have a client and a schema we have what we need to make a [*repository*](docs/repository.md). A repository provides the means to read, write, and remove entities. Creating a repository is pretty straightforward:
Now that we have a client and a schema we have what we need to make a [*repository*](docs/classes/Repository.md). A repository provides the means to read, write, and remove entities. Creating a repository is pretty straightforward:

```javascript
import { Repository } from 'redis-om'
Expand Down
14 changes: 7 additions & 7 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ A constructor that creates an [Entity](classes/Entity.md) of type TEntity.

#### Defined in

[lib/entity/entity.ts:10](https://github.com/redis-developer/redis-om-node/blob/d4db235/lib/entity/entity.ts#L10)
[lib/entity/entity.ts:10](https://github.com/redis-developer/redis-om-node/blob/b9319e2/lib/entity/entity.ts#L10)

___

Expand All @@ -85,7 +85,7 @@ A JavaScript object containing the underlying data of an [Entity](classes/Entity

#### Defined in

[lib/entity/entity.ts:4](https://github.com/redis-developer/redis-om-node/blob/d4db235/lib/entity/entity.ts#L4)
[lib/entity/entity.ts:4](https://github.com/redis-developer/redis-om-node/blob/b9319e2/lib/entity/entity.ts#L4)

___

Expand All @@ -97,7 +97,7 @@ Contains instructions telling how to map a property on an [Entity](classes/Entit

#### Defined in

[lib/schema/schema-definitions.ts:54](https://github.com/redis-developer/redis-om-node/blob/d4db235/lib/schema/schema-definitions.ts#L54)
[lib/schema/schema-definitions.ts:54](https://github.com/redis-developer/redis-om-node/blob/b9319e2/lib/schema/schema-definitions.ts#L54)

___

Expand All @@ -117,7 +117,7 @@ A function that generates random [Entity IDs](classes/Entity.md#entityid).

#### Defined in

[lib/schema/schema-definitions.ts:68](https://github.com/redis-developer/redis-om-node/blob/d4db235/lib/schema/schema-definitions.ts#L68)
[lib/schema/schema-definitions.ts:68](https://github.com/redis-developer/redis-om-node/blob/b9319e2/lib/schema/schema-definitions.ts#L68)

___

Expand All @@ -136,7 +136,7 @@ contains a [FieldDefinition](README.md#fielddefinition) that tell Redis ŌM how

#### Defined in

[lib/schema/schema-definitions.ts:59](https://github.com/redis-developer/redis-om-node/blob/d4db235/lib/schema/schema-definitions.ts#L59)
[lib/schema/schema-definitions.ts:59](https://github.com/redis-developer/redis-om-node/blob/b9319e2/lib/schema/schema-definitions.ts#L59)

___

Expand All @@ -157,7 +157,7 @@ Configuration options for a [Schema](classes/Schema.md).

#### Defined in

[lib/schema/schema-options.ts:7](https://github.com/redis-developer/redis-om-node/blob/d4db235/lib/schema/schema-options.ts#L7)
[lib/schema/schema-options.ts:7](https://github.com/redis-developer/redis-om-node/blob/b9319e2/lib/schema/schema-options.ts#L7)

___

Expand All @@ -169,4 +169,4 @@ The type of data structure in Redis to map objects to.

#### Defined in

[lib/client.ts:21](https://github.com/redis-developer/redis-om-node/blob/d4db235/lib/client.ts#L21)
[lib/client.ts:21](https://github.com/redis-developer/redis-om-node/blob/b9319e2/lib/client.ts#L21)
10 changes: 5 additions & 5 deletions docs/classes/Client.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ let client = new Client();
await client.open();
```

A Client is primarily used by a [Repository](Repository.md) and a client is required in
A Client is primarily used by a [Repository](Repository.md) which requires a client in
its constructor.

## Table of contents
Expand Down Expand Up @@ -47,7 +47,7 @@ Close the connection to Redis.

#### Defined in

[lib/client.ts:79](https://github.com/redis-developer/redis-om-node/blob/d4db235/lib/client.ts#L79)
[lib/client.ts:79](https://github.com/redis-developer/redis-om-node/blob/b9319e2/lib/client.ts#L79)

___

Expand Down Expand Up @@ -77,7 +77,7 @@ The raw results of calling the Redis command.

#### Defined in

[lib/client.ts:56](https://github.com/redis-developer/redis-om-node/blob/d4db235/lib/client.ts#L56)
[lib/client.ts:56](https://github.com/redis-developer/redis-om-node/blob/b9319e2/lib/client.ts#L56)

___

Expand Down Expand Up @@ -107,7 +107,7 @@ A repository for the provided schema.

#### Defined in

[lib/client.ts:71](https://github.com/redis-developer/redis-om-node/blob/d4db235/lib/client.ts#L71)
[lib/client.ts:71](https://github.com/redis-developer/redis-om-node/blob/b9319e2/lib/client.ts#L71)

___

Expand All @@ -129,4 +129,4 @@ Open a connection to Redis at the provided URL.

#### Defined in

[lib/client.ts:43](https://github.com/redis-developer/redis-om-node/blob/d4db235/lib/client.ts#L43)
[lib/client.ts:43](https://github.com/redis-developer/redis-om-node/blob/b9319e2/lib/client.ts#L43)
2 changes: 1 addition & 1 deletion docs/classes/Entity.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ The generated entity ID.

#### Defined in

[lib/entity/entity.ts:22](https://github.com/redis-developer/redis-om-node/blob/d4db235/lib/entity/entity.ts#L22)
[lib/entity/entity.ts:22](https://github.com/redis-developer/redis-om-node/blob/b9319e2/lib/entity/entity.ts#L22)
2 changes: 1 addition & 1 deletion docs/classes/RedisError.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Error.constructor

#### Defined in

[lib/errors.ts:2](https://github.com/redis-developer/redis-om-node/blob/d4db235/lib/errors.ts#L2)
[lib/errors.ts:2](https://github.com/redis-developer/redis-om-node/blob/b9319e2/lib/errors.ts#L2)

## Properties

Expand Down
24 changes: 12 additions & 12 deletions docs/classes/Repository.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ let repository = new Repository<Foo>(schema, client);
let foo = await repository.fetch('01FK6TCJBDK41RJ766A4SBWDJ9');
foo.aString = 'bar';
foo.aBoolean = false;
await repositroy.save(foo);
await repository.save(foo);
```

Be sure to use the repository to create a new instance of [Entity](Entity.md) you want
Expand All @@ -24,7 +24,7 @@ to create before you save it:
let foo = await repository.createEntity();
foo.aString = 'bar';
foo.aBoolean = false;
await repositroy.save(foo);
await repository.save(foo);
```

If you want to the [Repository.search](Repository.md#search) method, you need to create an index
Expand All @@ -34,7 +34,7 @@ first, and you need RediSearch or RedisJSON installed on your instance of Redis:
await repository.createIndex();
let entities = await repository.search()
.where('aString').eq('bar')
.and('Aboolean).is.false().returnAll();
.and('aBoolean').is.false().returnAll();
```

## Type parameters
Expand Down Expand Up @@ -77,12 +77,12 @@ Constructs a new Repository.

| Name | Type | Description |
| :------ | :------ | :------ |
| `schema` | [`Schema`](Schema.md)<`TEntity`\> | The schema for this Repository. |
| `schema` | [`Schema`](Schema.md)<`TEntity`\> | The [Schema](Schema.md) for this Repository. |
| `client` | [`Client`](Client.md) | An open [Client](Client.md). |

#### Defined in

[lib/repository/repository.ts:60](https://github.com/redis-developer/redis-om-node/blob/d4db235/lib/repository/repository.ts#L60)
[lib/repository/repository.ts:60](https://github.com/redis-developer/redis-om-node/blob/b9319e2/lib/repository/repository.ts#L60)

## Methods

Expand All @@ -100,7 +100,7 @@ A newly created Entity.

#### Defined in

[lib/repository/repository.ts:92](https://github.com/redis-developer/redis-om-node/blob/d4db235/lib/repository/repository.ts#L92)
[lib/repository/repository.ts:92](https://github.com/redis-developer/redis-om-node/blob/b9319e2/lib/repository/repository.ts#L92)

___

Expand All @@ -117,7 +117,7 @@ that RediSearch or RedisJSON is installed on your instance of Redis.

#### Defined in

[lib/repository/repository.ts:71](https://github.com/redis-developer/redis-om-node/blob/d4db235/lib/repository/repository.ts#L71)
[lib/repository/repository.ts:71](https://github.com/redis-developer/redis-om-node/blob/b9319e2/lib/repository/repository.ts#L71)

___

Expand All @@ -135,7 +135,7 @@ on your instance of Redis.

#### Defined in

[lib/repository/repository.ts:84](https://github.com/redis-developer/redis-om-node/blob/d4db235/lib/repository/repository.ts#L84)
[lib/repository/repository.ts:84](https://github.com/redis-developer/redis-om-node/blob/b9319e2/lib/repository/repository.ts#L84)

___

Expand All @@ -161,7 +161,7 @@ The matching Entity.

#### Defined in

[lib/repository/repository.ts:130](https://github.com/redis-developer/redis-om-node/blob/d4db235/lib/repository/repository.ts#L130)
[lib/repository/repository.ts:130](https://github.com/redis-developer/redis-om-node/blob/b9319e2/lib/repository/repository.ts#L130)

___

Expand All @@ -184,7 +184,7 @@ not found, does nothing.

#### Defined in

[lib/repository/repository.ts:151](https://github.com/redis-developer/redis-om-node/blob/d4db235/lib/repository/repository.ts#L151)
[lib/repository/repository.ts:151](https://github.com/redis-developer/redis-om-node/blob/b9319e2/lib/repository/repository.ts#L151)

___

Expand All @@ -209,7 +209,7 @@ The ID of the Entity just saved.

#### Defined in

[lib/repository/repository.ts:103](https://github.com/redis-developer/redis-om-node/blob/d4db235/lib/repository/repository.ts#L103)
[lib/repository/repository.ts:103](https://github.com/redis-developer/redis-om-node/blob/b9319e2/lib/repository/repository.ts#L103)

___

Expand All @@ -228,4 +228,4 @@ A [Search](Search.md) object.

#### Defined in

[lib/repository/repository.ts:162](https://github.com/redis-developer/redis-om-node/blob/d4db235/lib/repository/repository.ts#L162)
[lib/repository/repository.ts:162](https://github.com/redis-developer/redis-om-node/blob/b9319e2/lib/repository/repository.ts#L162)
27 changes: 6 additions & 21 deletions docs/classes/Schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ let schema = new Schema(Foo, {
});
```

A Schema is primarily used by a [Repository](Repository.md) and a schema is required in
A Schema is primarily used by a [Repository](Repository.md) which requires a Schema in
its constructor.

## Type parameters
Expand All @@ -37,7 +37,6 @@ its constructor.
- [dataStructure](Schema.md#datastructure)
- [indexName](Schema.md#indexname)
- [prefix](Schema.md#prefix)
- [redisSchema](Schema.md#redisschema)

### Methods

Expand Down Expand Up @@ -65,7 +64,7 @@ its constructor.

#### Defined in

[lib/schema/schema.ts:53](https://github.com/redis-developer/redis-om-node/blob/d4db235/lib/schema/schema.ts#L53)
[lib/schema/schema.ts:53](https://github.com/redis-developer/redis-om-node/blob/b9319e2/lib/schema/schema.ts#L53)

## Accessors

Expand All @@ -82,7 +81,7 @@ that this Schema uses to store [Entities](Entity.md) in Redis.

#### Defined in

[lib/schema/schema.ts:72](https://github.com/redis-developer/redis-om-node/blob/d4db235/lib/schema/schema.ts#L72)
[lib/schema/schema.ts:72](https://github.com/redis-developer/redis-om-node/blob/b9319e2/lib/schema/schema.ts#L72)

___

Expand All @@ -98,7 +97,7 @@ The configured name for the RediSearch index for this Schema.

#### Defined in

[lib/schema/schema.ts:66](https://github.com/redis-developer/redis-om-node/blob/d4db235/lib/schema/schema.ts#L66)
[lib/schema/schema.ts:66](https://github.com/redis-developer/redis-om-node/blob/b9319e2/lib/schema/schema.ts#L66)

___

Expand All @@ -114,21 +113,7 @@ The configured keyspace prefix in Redis for this Schema.

#### Defined in

[lib/schema/schema.ts:63](https://github.com/redis-developer/redis-om-node/blob/d4db235/lib/schema/schema.ts#L63)

___

### redisSchema

`get` **redisSchema**(): `string`[]

#### Returns

`string`[]

#### Defined in

[lib/schema/schema.ts:73](https://github.com/redis-developer/redis-om-node/blob/d4db235/lib/schema/schema.ts#L73)
[lib/schema/schema.ts:63](https://github.com/redis-developer/redis-om-node/blob/b9319e2/lib/schema/schema.ts#L63)

## Methods

Expand All @@ -144,4 +129,4 @@ Generates a unique string using the configured [IdStrategy](../README.md#idstrat

#### Defined in

[lib/schema/schema.ts:79](https://github.com/redis-developer/redis-om-node/blob/d4db235/lib/schema/schema.ts#L79)
[lib/schema/schema.ts:81](https://github.com/redis-developer/redis-om-node/blob/b9319e2/lib/schema/schema.ts#L81)
Loading

0 comments on commit 8f6d2ee

Please sign in to comment.