Documentation
¶
Overview ¶
Package nocodb implements the NocoDB adapter for the database capability.
Index ¶
- Constants
- func Register(app string, svc Service) error
- type Adapter
- func (a *Adapter) CreateRecord(ctx context.Context, in CreateRecordInput) (*capability.NocoRecord, error)
- func (a *Adapter) DeleteRecord(ctx context.Context, in DeleteRecordInput) error
- func (a *Adapter) GetRecord(ctx context.Context, in GetRecordInput) (*capability.NocoRecord, error)
- func (a *Adapter) GetTable(ctx context.Context, in GetTableInput) (*capability.NocoTable, error)
- func (a *Adapter) HealthCheck(ctx context.Context) (bool, error)
- func (a *Adapter) ListBases(ctx context.Context) (*capability.ListResult[capability.NocoBase], error)
- func (a *Adapter) ListRecords(ctx context.Context, in ListRecordsInput) (*capability.ListResult[capability.NocoRecord], error)
- func (a *Adapter) ListTables(ctx context.Context, in ListTablesInput) (*capability.ListResult[capability.NocoTable], error)
- func (a *Adapter) UpdateRecord(ctx context.Context, in UpdateRecordInput) (*capability.NocoRecord, error)
- type CreateRecordInput
- type DeleteRecordInput
- type GetRecordInput
- type GetTableInput
- type ListRecordsInput
- type ListTablesInput
- type Service
- type UpdateRecordInput
Constants ¶
const ( OpListBases = "list_bases" OpListTables = "list_tables" OpGetTable = "get_table" OpListRecords = "list_records" OpGetRecord = "get_record" OpCreateRecord = "create_record" OpUpdateRecord = "update_record" OpDeleteRecord = "delete_record" OpHealth = "health" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter implements Service using the NocoDB provider client.
func (*Adapter) CreateRecord ¶
func (a *Adapter) CreateRecord(ctx context.Context, in CreateRecordInput) (*capability.NocoRecord, error)
CreateRecord creates a record with the given fields.
func (*Adapter) DeleteRecord ¶
func (a *Adapter) DeleteRecord(ctx context.Context, in DeleteRecordInput) error
DeleteRecord deletes a record by ID.
func (*Adapter) GetRecord ¶
func (a *Adapter) GetRecord(ctx context.Context, in GetRecordInput) (*capability.NocoRecord, error)
GetRecord returns a single record.
func (*Adapter) GetTable ¶
func (a *Adapter) GetTable(ctx context.Context, in GetTableInput) (*capability.NocoTable, error)
GetTable returns table metadata including columns.
func (*Adapter) HealthCheck ¶
HealthCheck reports whether the NocoDB backend is reachable. Provider failures are treated as unhealthy (false, nil), not as invoke errors.
func (*Adapter) ListBases ¶
func (a *Adapter) ListBases(ctx context.Context) (*capability.ListResult[capability.NocoBase], error)
ListBases returns bases visible to the configured API token (first page).
func (*Adapter) ListRecords ¶
func (a *Adapter) ListRecords(ctx context.Context, in ListRecordsInput) (*capability.ListResult[capability.NocoRecord], error)
ListRecords returns records for a table.
func (*Adapter) ListTables ¶
func (a *Adapter) ListTables(ctx context.Context, in ListTablesInput) (*capability.ListResult[capability.NocoTable], error)
ListTables returns tables in a base (first page).
func (*Adapter) UpdateRecord ¶
func (a *Adapter) UpdateRecord(ctx context.Context, in UpdateRecordInput) (*capability.NocoRecord, error)
UpdateRecord updates a record by ID. Numeric IDs are encoded as JSON numbers by the provider.
type CreateRecordInput ¶
CreateRecordInput holds parameters for creating a record.
type DeleteRecordInput ¶
DeleteRecordInput holds parameters for deleting a record.
type GetRecordInput ¶
GetRecordInput holds parameters for fetching a single record.
type GetTableInput ¶
type GetTableInput struct {
TableID string
}
GetTableInput holds parameters for fetching table metadata.
type ListRecordsInput ¶
type ListRecordsInput struct {
TableID string
Limit int
Offset int
Where string
Sort string
Fields string
}
ListRecordsInput holds parameters for listing records.
type ListTablesInput ¶
type ListTablesInput struct {
BaseID string
}
ListTablesInput holds parameters for listing tables in a base.
type Service ¶
type Service interface {
ListBases(ctx context.Context) (*capability.ListResult[capability.NocoBase], error)
ListTables(ctx context.Context, in ListTablesInput) (*capability.ListResult[capability.NocoTable], error)
GetTable(ctx context.Context, in GetTableInput) (*capability.NocoTable, error)
ListRecords(ctx context.Context, in ListRecordsInput) (*capability.ListResult[capability.NocoRecord], error)
GetRecord(ctx context.Context, in GetRecordInput) (*capability.NocoRecord, error)
CreateRecord(ctx context.Context, in CreateRecordInput) (*capability.NocoRecord, error)
UpdateRecord(ctx context.Context, in UpdateRecordInput) (*capability.NocoRecord, error)
DeleteRecord(ctx context.Context, in DeleteRecordInput) error
HealthCheck(ctx context.Context) (bool, error)
}
Service defines the NocoDB capability contract. List operations return the first page from NocoDB; use Page for pagination metadata. Record IDs assume the default NocoDB "Id" primary key (numeric or string custom PK).
func New ¶
func New() Service
New creates an Adapter using the default provider client (reads config from YAML). Returns nil when the provider is not configured.
func NewWithClient ¶
func NewWithClient(c client) Service
NewWithClient creates an Adapter with a specific client, useful for testing.