Serializer / Deserializer
Serializer
@DynamoEntity()
class Entity {
@DynamoProperty({
keyType: KeyType.hash,
propertyName: "id",
serializer: (arg: SerializerArg<Entity>) => { // <<<
const source: Entity = arg.source;
return [source.x, source.y].join("_");
}
})
__id?: string;
x: string;
y: string;
constructor(x: string, y: string) {
this.x = x;
this.y = y;
}
}
const entity = new Entity("Hello", "World!");
const dynamo = Mapper.formation(entity, Entity);Deserailizer
Last updated