Documentation
¶
Overview ¶
Package nocodb implements the NocoDB provider.
Index ¶
- Constants
- type Base
- type BaseList
- type Column
- type ListRecordsQuery
- type NocoDB
- func (n *NocoDB) CreateRecord(ctx context.Context, tableID string, fields map[string]any) (Record, error)
- func (n *NocoDB) DeleteRecord(ctx context.Context, tableID, id string) error
- func (n *NocoDB) GetRecord(ctx context.Context, tableID, recordID string) (Record, error)
- func (n *NocoDB) GetTable(ctx context.Context, tableID string) (*Table, error)
- func (n *NocoDB) ListBases(ctx context.Context) (*BaseList, error)
- func (n *NocoDB) ListRecords(ctx context.Context, tableID string, q ListRecordsQuery) (*RecordList, error)
- func (n *NocoDB) ListTables(ctx context.Context, baseID string) (*TableList, error)
- func (n *NocoDB) UpdateRecord(ctx context.Context, tableID string, fields map[string]any) (Record, error)
- type PageInfo
- type Record
- type RecordList
- type StatusError
- type Table
- type TableList
Constants ¶
const ( ID = "nocodb" EndpointKey = "endpoint" TokenKey = "token" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Column ¶
type Column struct {
ID string `json:"id"`
Title string `json:"title"`
UIDT string `json:"uidt"`
ColumnName string `json:"column_name"`
}
Column is a table column definition.
type ListRecordsQuery ¶
ListRecordsQuery holds optional query parameters for listing records.
type NocoDB ¶
type NocoDB struct {
// contains filtered or unexported fields
}
NocoDB is an HTTP client for the NocoDB v2 Data and Meta APIs.
func GetClient ¶
func GetClient() *NocoDB
GetClient builds a NocoDB client from vendors.nocodb config. Returns nil when endpoint is not configured.
func NewNocoDB ¶
NewNocoDB creates a NocoDB client with the given endpoint and API token. Authentication uses the xc-token header. Returns nil when endpoint is empty.
func (*NocoDB) CreateRecord ¶
func (n *NocoDB) CreateRecord(ctx context.Context, tableID string, fields map[string]any) (Record, error)
CreateRecord creates a record with the given field values.
func (*NocoDB) DeleteRecord ¶
DeleteRecord deletes a record by ID. Numeric record IDs are sent as JSON numbers to match the NocoDB v2 contract.
func (*NocoDB) ListRecords ¶
func (n *NocoDB) ListRecords(ctx context.Context, tableID string, q ListRecordsQuery) (*RecordList, error)
ListRecords returns records for a table with optional filters.
func (*NocoDB) ListTables ¶
ListTables returns tables belonging to the given base (first page).
type PageInfo ¶
type PageInfo struct {
TotalRows int `json:"totalRows"`
Page int `json:"page"`
PageSize int `json:"pageSize"`
IsFirstPage bool `json:"isFirstPage"`
IsLastPage bool `json:"isLastPage"`
}
PageInfo holds NocoDB list pagination metadata.
type RecordList ¶
RecordList is the envelope returned by list records.
type StatusError ¶
StatusError is returned when NocoDB responds with a non-2xx status.
func AsStatusError ¶
func AsStatusError(err error) (*StatusError, bool)
AsStatusError extracts a StatusError from err if present.
func (*StatusError) Error ¶
func (e *StatusError) Error() string
Error implements the error interface.