-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Embedded entities with entity schema
Added `embeddeds` field into EntitySchemaOptions Added transformation to MetadataArgsStorage for embedded entities Updated docs Created new tests cases for EntitySchema with Embedded Entities Changed type for field: `target` in EmbeddedMetadataArgs CLOSES: #3632
- Loading branch information
Showing
19 changed files
with
622 additions
and
197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { EntitySchema } from "./EntitySchema"; | ||
|
||
export class EntitySchemaEmbeddedColumnOptions { | ||
/** | ||
* Schema of embedded entity | ||
*/ | ||
schema: EntitySchema; | ||
|
||
/** | ||
* Embedded column prefix. | ||
* If set to empty string or false, then prefix is not set at all. | ||
*/ | ||
prefix?: string | boolean; | ||
|
||
/** | ||
* Indicates if this embedded is in array mode. | ||
* | ||
* This option works only in mongodb. | ||
*/ | ||
array?: boolean; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { TypeORMError } from "../error"; | ||
|
||
export class EntitySchemaEmbeddedError extends TypeORMError { | ||
static createEntitySchemaIsRequiredException(field: string): EntitySchemaEmbeddedError { | ||
return new EntitySchemaEmbeddedError(`EntitySchema is required for ${field} embedded field`); | ||
} | ||
|
||
static createTargetIsRequired(field: string): EntitySchemaEmbeddedError { | ||
return new EntitySchemaEmbeddedError(`Target field is required for ${field} embedded EntitySchema`); | ||
} | ||
|
||
constructor(message: string) { | ||
super(message); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.