Stop being the product.
Become the owner.
or
sign uplog in

UQL v0.8.0+: Define Entities without Decorators! just…

UQL v0.8.0+: Define Entities without Decorators!

just dropped v0.8.0 of UQL, with one of the most requested features: **Decorator-Free Entity Definitions**. So not everyone wants (or can) use `experimentalDecorators` in their `tsconfig.json`. This is common in certain edge runtimes, specific build pipelines, or simply for developers who prefer a more functional or imperative https://www.uql-orm.dev/entities/imperative style.

With the new `defineEntity` API, you can now register your database entities entirely through code. This new approach is 100% compatible with envs where decorators are disabled or unsupported.

Check out the new syntax:

import { defineEntity } from 'uql-orm';

// No decorators, no tsconfig magic required!
class User {}

defineEntity(User, {
name: 'users',
fields: {
id: { type: 'uuid', isId: true },
name: { type: String },
email: { type: String },
},
indexes: [
{ columns: ['name'] },
{ columns: ['email'], unique: true },
],
});
#programming #dev #js #technology
earnings
3,000 mlx total
$0  total
engagement
3 views
0 reactions

0 comments