# Class: Relation

Class which represent a relationship. Provides attributes and methods for details of the relationship.

abstract

hideconstructor

# Hierarchy

# Accessors

# name

get name(): string

Defined in pg-structure/base/relation.ts:100

Suggested name for relation.

see {@link ../relation-names.md Relation Names}

Returns: string


# sourceAdjective

get sourceAdjective(): string | undefined

Defined in pg-structure/base/relation.ts:85

Source table's adjective extracted from foreign key name.

Returns: string | undefined


# sourceName

get sourceName(): string

Defined in pg-structure/base/relation.ts:75

Source table name.

Returns: string


# targetAdjective

get targetAdjective(): string | undefined

Defined in pg-structure/base/relation.ts:90

Source table's adjective extracted from foreign key name.

Returns: string | undefined


# targetName

get targetName(): string

Defined in pg-structure/base/relation.ts:80

Target table name

Returns: string

# Methods

# getName

getName(relationNameFunction: RelationNameFunction | BuiltinRelationNameFunction): string

Defined in pg-structure/base/relation.ts:112

Retunrs name for the relation using given naming function.

Parameters:

Name Type Description
relationNameFunction RelationNameFunction | BuiltinRelationNameFunction is custom function or name of the builtin function to generate names with.

Returns: string

name for the relation using naming function.


# getSourceNameWithout

getSourceNameWithout(without: RelationWithout | RelationWithout[]): string

Defined in pg-structure/base/relation.ts:60

Returns source table name after replacing given tables' names from it.

Parameters:

Name Type Description
without RelationWithout | RelationWithout[] is type or types of tables to exclude names of.

Returns: string

source table name after given tables' names replaced.


# getTargetNameWithout

getTargetNameWithout(without: RelationWithout | RelationWithout[]): string

Defined in pg-structure/base/relation.ts:70

Returns target table name after replacing given tables' names from it.

Parameters:

Name Type Description
without RelationWithout | RelationWithout[] is type or types of tables to exclude names of.

Returns: string

target table name after given tables' names replaced.