@powfix/core-js 0.13.5 → 0.13.6

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.
@@ -6,4 +6,8 @@ export declare class SequelizeUtils {
6
6
  columnName: string;
7
7
  allowNull: boolean;
8
8
  }) => Partial<ModelAttributeColumnOptions>;
9
+ static getUuidColumn: ({ columnName, allowNull }: {
10
+ columnName: string;
11
+ allowNull: boolean;
12
+ }) => Partial<ModelAttributeColumnOptions>;
9
13
  }
@@ -58,3 +58,33 @@ SequelizeUtils.getForeignUuidColumn = ({ columnName, allowNull }) => {
58
58
  };
59
59
  }
60
60
  };
61
+ SequelizeUtils.getUuidColumn = ({ columnName, allowNull }) => {
62
+ if (allowNull) {
63
+ return {
64
+ type: "binary(16)",
65
+ allowNull,
66
+ get() {
67
+ const value = this.getDataValue(columnName);
68
+ if (value === null) {
69
+ return value;
70
+ }
71
+ return UuidUtils_1.UuidUtils.toString(this.getDataValue(columnName));
72
+ },
73
+ set(uuid) {
74
+ this.setDataValue(columnName, uuid === null ? null : UuidUtils_1.UuidUtils.toBuffer(uuid));
75
+ }
76
+ };
77
+ }
78
+ else {
79
+ return {
80
+ type: "binary(16)",
81
+ allowNull,
82
+ get() {
83
+ return UuidUtils_1.UuidUtils.toString(this.getDataValue(columnName));
84
+ },
85
+ set(uuid) {
86
+ this.setDataValue(columnName, UuidUtils_1.UuidUtils.toBuffer(uuid));
87
+ }
88
+ };
89
+ }
90
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powfix/core-js",
3
- "version": "0.13.5",
3
+ "version": "0.13.6",
4
4
  "description": "core package",
5
5
  "author": "Kwon Kyung-Min <powfix@gmail.com>",
6
6
  "private": false,