![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@uql/mongo
Advanced tools
flexible and efficient ORM, with declarative JSON syntax and smart type-safety
Learn more of uql in the website https://uql.io :high_brightness:
uql
is a flexible and efficient ORM
, with declarative JSON
syntax and really smart type-safety.
The uql
queries can be safely written in the frontend (browser/mobile) and sent to the backend; or only use uql
in the backend, or even in a mobile app with an embedded database (like sqlite
).
JSON
(serializable) syntax for all the queries.TypeScript
to get smart type-safety everywhere.$project
, $filter
, $sort
, $limit
works at multiple levels (including deep relations and their fields).transactions
.connection pooling
.Postgres
, MySQL
, MariaDB
, SQLite
, MongoDB
.npm install @uql/core --save
or
yarn add @uql/core
Database | Package |
---|---|
MySQL | @uql/mysql |
PostgreSQL | @uql/postgres |
MariaDB | @uql/maria |
MongoDB | @uql/mongo |
SQLite | @uql/sqlite |
E.g. for PostgreSQL
npm install @uql/postgres --save
or with yarn
yarn add @uql/postgres
tsconfig.json
may need the following flags:"target": "es2020",
"experimentalDecorators": true,
"emitDecoratorMetadata": true
A default querier-pool can be set in any of the bootstrap files of your app (e.g. in the server.ts
).
import { setDefaultQuerierPool } from '@uql/core';
import { PgQuerierPool } from '@uql/postgres';
const querierPool = new PgQuerierPool(
{
host: 'localhost',
user: 'theUser',
password: 'thePassword',
database: 'theDatabase',
},
// a logger can optionally be passed so the SQL queries are logged
console.log
);
setDefaultQuerierPool(querierPool);
Take any dump class (aka DTO) and annotate it with the decorators from '@uql/core/entity'
.
import { v4 as uuidv4 } from 'uuid';
import { Field, ManyToOne, Id, OneToMany, Entity, OneToOne, ManyToMany } from '@uql/core/entity';
@Entity()
export class Profile {
/**
* primary-key.
* the `onInsert` callback can be used to specify a custom mechanism for auto-generating
* the default value of a field when inserting a new record.
*/
@Id({ onInsert: uuidv4 })
id?: string;
@Field()
picture?: string;
/**
* foreign-keys are really simple to specify.
*/
@Field({ reference: () => User })
creatorId?: string;
}
@Entity()
export class User {
@Id({ onInsert: uuidv4 })
id?: string;
@Field()
name?: string;
@Field()
email?: string;
@Field()
password?: string;
/**
* `mappedBy` can be a callback or a string (callback is useful for auto-refactoring).
*/
@OneToOne({ entity: () => Profile, mappedBy: (profile) => profile.creatorId, cascade: true })
profile?: Profile;
}
@Entity()
export class MeasureUnitCategory {
@Id({ onInsert: uuidv4 })
id?: string;
@Field()
name?: string;
@OneToMany({ entity: () => MeasureUnit, mappedBy: (measureUnit) => measureUnit.category })
measureUnits?: MeasureUnit[];
}
@Entity()
export class MeasureUnit {
@Id({ onInsert: uuidv4 })
id?: string;
@Field()
name?: string;
@Field({ reference: () => MeasureUnitCategory })
categoryId?: string;
@ManyToOne({ cascade: 'persist' })
category?: MeasureUnitCategory;
}
import { getQuerier } from '@uql/core';
import { User } from './entity';
const querier = await getQuerier();
const id = await this.querier.insertOne(User, {
email: 'lorem@example.com',
profile: { picture: 'ipsum.jpg' },
});
const users = await querier.findMany(User, {
$project: { id: true, email: true, profile: ['picture'] },
$filter: { email: { $iendsWith: '@google.com' } },
$sort: { createdAt: -1 },
$limit: 100,
});
await querier.release();
See more in https://uql.io :high_brightness:
FAQs
flexible and efficient ORM, with declarative JSON syntax and smart type-safety
The npm package @uql/mongo receives a total of 15 weekly downloads. As such, @uql/mongo popularity was classified as not popular.
We found that @uql/mongo demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.