Comments (1)
For example, for my project, I hacked together some sugar. Let me know if you want me to post the implementation (or want a PR).
For example, suppose you have an entity that is defined with decorators like this:
@Entity({
name: "my_entity",
primaryKey: {
partitionKey: "my_entity#{{id}}",
sortKey: "my_entity#{{id}}",
},
})
class MyEntity {
@AutoGenerateAttribute({
strategy: AUTO_GENERATE_ATTRIBUTE_STRATEGY.KSUID,
})
id: string;
@Attribute()
fooAttribute: string;
}
If you didn't have decorators you could express it instead as...
class MyEntity {
id: string;
fooAttribute: string;
}
registerEntity({
entity: {
constructor: MyEntity,
name: "my_entity",
primaryKey: {
partitionKey: "my_entity#{{id}}",
sortKey: "my_entity#{{id}}",
},
},
attributes: [
Attribute("id")
.string()
.autoGenerate({ strategy: AUTO_GENERATE_ATTRIBUTE_STRATEGY.UUID4 }),
Attribute("fooAttribute").string(),
],
});
Obviously, it's not as elegant being able to use decorators and you lose some type safety, but it's still worth it for me compared to the alternative, which is abandoning TypeDorm altogether and working directly with the AWS SDK. Also, I could probably modify this sugar to make it even more slick (I just hacked it together).
from typedorm.
Related Issues (20)
- Updating entity with unique item and fail
- Unable to query anything from DynamoDB
- Bundling error with serverless-bundle HOT 1
- I can update "number" fields but I can´t create them
- Support column name alias mapping
- "No such connection with name \"default\" exists" or "Connection Already Exists" HOT 2
- Can I remove (update in general) nested attributes? HOT 2
- Add support for LSI/GSI to EntityManager.findOne() HOT 1
- @TransformToDynamo and @TransformFromDynamo not being called HOT 2
- Update TRANSACTION_WRITE_ITEMS_LIMIT to properly reflect Dynamo DB Transaction Limit HOT 1
- Setting values in a map attribute
- Attribute auto generation fails if typescript flag `useDefineForClassFields` is true HOT 1
- Updating item SET IF_NOT_EXISTS and LIST_APPEND expected behavior
- WriteTransaction cancellation reasons not properly handled
- Does TypeDORM Support Write Sharding for DynamoDB? HOT 1
- EntityManager.find() with filter+limit can spawn thousands of recursive sequential queries HOT 2
- When update, decorated transformations on the primary key attributes are not applied.
- Still maintained?
- UpdateBody type is not usably exported for some use cases
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from typedorm.