Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connector ¶
type Connector interface { // Sync is a request for a sync with Fivetran, the response should contain the (partial) sync Sync(ctx context.Context, req *Request) (*Response, error) }
Connector is translates Fivetran sync requests to actual data See also: https://fivetran.com/docs/functions#architecture
func NewConnector ¶
func NewConnector(tables []TableConnector) (Connector, error)
NewConnector creates a new fivetran connector with the given tables and their respective connector
type Request ¶
type Request struct { Agent string `json:"agent"` State State `json:"state"` Secrets Secrets `json:"secrets"` }
Request from Fivetran as describe here: https://fivetran.com/docs/functions#requestformat
func NewRequest ¶
func NewRequest() *Request
type Response ¶
type Response struct { State State `json:"state"` Insert ResponseInserts `json:"insert"` Delete ResponseDeletes `json:"delete"` Schema map[string]*ResponseTableSchema `json:"schema"` HasMore bool `json:"hasMore"` }
Response to Fivetran as described here https://fivetran.com/docs/functions#responseformat
func NewResponse ¶
func NewResponse() *Response
type ResponseDeletes ¶
type ResponseInserts ¶
type ResponseTableSchema ¶
type ResponseTableSchema struct {
PrimaryKey []string `json:"primary_key"`
}
type Table ¶
type Table struct { // Name the name of the table Name string // State opaque string to represent the current 'state' of the sync, usually a database cursor State string // PrimaryKey the list of primary keys used for updates and deletes PrimaryKey []string // InsertRows additional rows to insert or update InsertRows []any // DeleteRows rows to mark deleted, providing just the id column suffices DeleteRows []any // HasMore whether the connector could provide more data or all is synced HasMore bool }
Table represents a single synced table
type TableConnector ¶
type TableConnector interface { // Name the name of the table Name() string // Sync synchronizes a table, starting from a previous state and returning the new data // as well as an updated state Sync(ctx context.Context, state string, secrets map[string]string) (*Table, error) }
TableConnector is the connector for a single table
Click to show internal directories.
Click to hide internal directories.