@rocketmq/schema 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# @rocketmq/schema
|
|
2
|
+
|
|
3
|
+
Decorator-based schema definition system for RocketMQ.
|
|
4
|
+
|
|
5
|
+
Provides the `@Schema()` and `@Field()` decorators used to define queue payload structures. This package automatically collects metadata that the `@rocketmq/core` SDK uses to generate Protobuf schemas for broker-side validation.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @rocketmq/schema
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { Schema, Field } from '@rocketmq/schema';
|
|
17
|
+
|
|
18
|
+
@Schema()
|
|
19
|
+
export class User {
|
|
20
|
+
@Field()
|
|
21
|
+
id!: string;
|
|
22
|
+
|
|
23
|
+
@Field()
|
|
24
|
+
name!: string;
|
|
25
|
+
|
|
26
|
+
@Field({ type: 'int32' })
|
|
27
|
+
age!: number;
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
This package is re-exported by `@rocketmq/core`, so you can just import from there in most applications.
|
|
32
|
+
|
|
33
|
+
## License
|
|
34
|
+
|
|
35
|
+
Apache 2.0
|