@ttoss/postgresdb 0.2.1 → 0.2.2
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 +27 -0
- package/dist/index.d.ts +4 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -122,3 +122,30 @@ All [Sequelize options](https://sequelize.org/api/v6/class/src/sequelize.js~sequ
|
|
|
122
122
|
### Sequelize decorators
|
|
123
123
|
|
|
124
124
|
This package exports all decorators from [sequelize-typescript](https://www.npmjs.com/package/sequelize-typescript), i.e., `@Table`, `@Column`, `@ForeignKey`, etc.
|
|
125
|
+
|
|
126
|
+
## Types
|
|
127
|
+
|
|
128
|
+
### `ModelColumns<T>`
|
|
129
|
+
|
|
130
|
+
A type that represents the columns of a model.
|
|
131
|
+
|
|
132
|
+
```typescript
|
|
133
|
+
import { Column, Model, type ModelColumns, Table } from '@ttoss/postgresdb';
|
|
134
|
+
|
|
135
|
+
@Table
|
|
136
|
+
class User extends Model<User> {
|
|
137
|
+
@Column
|
|
138
|
+
declare name?: string;
|
|
139
|
+
|
|
140
|
+
@Column
|
|
141
|
+
declare email: string;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* UserColumns = {
|
|
146
|
+
* name?: string;
|
|
147
|
+
* email: string;
|
|
148
|
+
* }
|
|
149
|
+
*/
|
|
150
|
+
type UserColumns = ModelColumns<User>;
|
|
151
|
+
```
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ModelCtor, Sequelize, SequelizeOptions } from 'sequelize-typescript';
|
|
1
|
+
import { ModelCtor, Sequelize, SequelizeOptions, Model } from 'sequelize-typescript';
|
|
2
2
|
export * from 'sequelize-typescript';
|
|
3
3
|
|
|
4
4
|
type Options<Models> = Omit<SequelizeOptions, 'models' | 'dialect'> & {
|
|
@@ -10,4 +10,6 @@ declare const initialize: <Models extends {
|
|
|
10
10
|
sequelize: Sequelize;
|
|
11
11
|
} & Models>;
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
type ModelColumns<T> = Omit<T, keyof Model> & Pick<Model, 'id' | 'createdAt' | 'updatedAt'>;
|
|
14
|
+
|
|
15
|
+
export { type ModelColumns, initialize };
|