• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

typeorm / typeorm / 14796576772

02 May 2025 01:52PM UTC coverage: 45.367% (-30.9%) from 76.309%
14796576772

Pull #11434

github

web-flow
Merge ec4ce2d00 into fadad1a74
Pull Request #11434: feat: release PR releases using pkg.pr.new

5216 of 12761 branches covered (40.87%)

Branch coverage included in aggregate %.

11439 of 23951 relevant lines covered (47.76%)

15712.55 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

9.09
/src/metadata/ExclusionMetadata.ts
1
import { EntityMetadata } from "./EntityMetadata"
2
import { NamingStrategyInterface } from "../naming-strategy/NamingStrategyInterface"
3
import { ExclusionMetadataArgs } from "../metadata-args/ExclusionMetadataArgs"
4

5
/**
6
 * Exclusion metadata contains all information about table's exclusion constraints.
7
 */
8
export class ExclusionMetadata {
4✔
9
    // ---------------------------------------------------------------------
10
    // Public Properties
11
    // ---------------------------------------------------------------------
12

13
    /**
14
     * Entity metadata of the class to which this exclusion constraint is applied.
15
     */
16
    entityMetadata: EntityMetadata
17

18
    /**
19
     * Target class to which metadata is applied.
20
     */
21
    target?: Function | string
22

23
    /**
24
     * Exclusion expression.
25
     */
26
    expression: string
27

28
    /**
29
     * User specified exclusion constraint name.
30
     */
31
    givenName?: string
32

33
    /**
34
     * Final exclusion constraint name.
35
     * If exclusion constraint name was given by a user then it stores normalized (by naming strategy) givenName.
36
     * If exclusion constraint name was not given then its generated.
37
     */
38
    name: string
39

40
    // ---------------------------------------------------------------------
41
    // Constructor
42
    // ---------------------------------------------------------------------
43

44
    constructor(options: {
45
        entityMetadata: EntityMetadata
46
        args?: ExclusionMetadataArgs
47
    }) {
48
        this.entityMetadata = options.entityMetadata
×
49

50
        if (options.args) {
×
51
            this.target = options.args.target
×
52
            this.expression = options.args.expression
×
53
            this.givenName = options.args.name
×
54
        }
55
    }
56

57
    // ---------------------------------------------------------------------
58
    // Public Build Methods
59
    // ---------------------------------------------------------------------
60

61
    /**
62
     * Builds some depend exclusion constraint properties.
63
     * Must be called after all entity metadata's properties map, columns and relations are built.
64
     */
65
    build(namingStrategy: NamingStrategyInterface): this {
66
        this.name = this.givenName
×
67
            ? this.givenName
68
            : namingStrategy.exclusionConstraintName(
69
                  this.entityMetadata.tableName,
70
                  this.expression,
71
              )
72
        return this
×
73
    }
74
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc