logologo
开始
手册
开发
插件
API
首页
English
简体中文
日本語
한국어
Español
Português
Deutsch
Français
Русский
Italiano
Türkçe
Українська
Tiếng Việt
Bahasa Indonesia
ไทย
Polski
Nederlands
Čeština
العربية
עברית
हिन्दी
Svenska
开始
手册
开发
插件
API
首页
logologo
API Overview

@nocobase/auth

AuthManager
Auth
BaseAuth

@nocobase/cache

CacheManager
Cache

@nocobase/cli

NocoBase CLI
全局环境变量

@nocobase/client

Application
Plugin

@nocobase/database

Collection
Field

interfaces

BaseInterface
Filter Operators

RelationRepository

BelongsToManyRepository
belongs-to-repository
HasManyRepository
HasOneRepository
Repository

shared

create-options
destroy-options
find-one
find-options
transaction
update-options

@nocobase/data-source-manager

DataSourceManager
DataSource (abstract)
ICollectionManager
ICollection
IField
IModel
IRepository

@nocobase/flow-engine

DataSourceManager
FlowContext
FlowEngine
FlowModel
FlowResource

@nocobase/logger

Logger

@nocobase/server

AppCommand
Application
AuditManager
Context
Migration
Plugin

@nocobase/sdk

Auth
Storage

@nocobase/telemetry

Metric
Telemetry
Trace
Previous PageFilter Operators
Next PageBelongsToManyRepository

#RelationRepository

RelationRepository 是关系类型的 Repository 对象,RelationRepository 可以实现在不加载关联的情况下对关联数据进行操作。基于 RelationRepository,每种关联都派生出对应的实现,分别为

  • HasOneRepository
  • HasManyRepository
  • BelongsToRepository
  • BelongsToManyRepository

#构造函数

签名

  • constructor(sourceCollection: Collection, association: string, sourceKeyValue: string | number)

参数

参数名类型默认值描述
sourceCollectionCollection-关联中的参照关系(referencing relation)对应的 Collection
associationstring-关联名称
sourceKeyValuestring | number-参照关系中对应的 key 值

#基类属性

#db: Database

数据库对象

#sourceCollection

关联中的参照关系(referencing relation)对应的 Collection

#targetCollection

关联中被参照关系(referenced relation)对应的 Collection

#association

sequelize 中的与当前关联对应的 association 对象

#associationField

collection 中的与当前关联对应的字段

#sourceKeyValue

参照关系中对应的 key 值