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 PageField
Next PageFilter Operators

#BaseInterface

#概览

BaseInterface 是所有 Interface 类型的基础类,用户可以自行继承此类实现自定义的 Interface 逻辑。

class CustomInterface extends BaseInterface {
  async toValue(value: string, ctx?: any): Promise<any> {
    // 自定义的 toValue 逻辑
  }

  toString(value: any, ctx?: any) {
    // 自定义的 toString 逻辑
  }
}
// 注册 Interface
db.interfaceManager.registerInterfaceType('customInterface', CustomInterface)

#接口

#toValue(value: string, ctx?: any): Promise

将外部的字符串转换为 interface 的实际值,值可直接传递给 Repository 进行写入操作

#toString(value: any, ctx?: any)

将 interface 的实际值转换为 string 类型,string 类型可用作导出、展示时使用