Documentation ¶
Index ¶
- type BuildSchemaFunc
- type CanConnectFunc
- type ConnectClient
- type DatabaseLogger
- type GetVitessShardsFunc
- type KeyspaceState
- type ListShardsFunc
- type MysqlClient
- type MysqlColumn
- type OnCursor
- type OnResult
- type OnUpdate
- type Operation
- type PingContextFunc
- type PlanetScaleSource
- type ReadFunc
- type SchemaBuilder
- type SerializedCursor
- type ShardStates
- type SyncState
- type TestConnectClient
- func (tcc *TestConnectClient) CanConnect(ctx context.Context, ps PlanetScaleSource) error
- func (tcc *TestConnectClient) ListShards(ctx context.Context, ps PlanetScaleSource) ([]string, error)
- func (tcc *TestConnectClient) Read(ctx context.Context, logger DatabaseLogger, ps PlanetScaleSource, ...) (*SerializedCursor, error)
- type TestMysqlClient
- func (t TestMysqlClient) BuildSchema(ctx context.Context, psc PlanetScaleSource, schemaBuilder SchemaBuilder) error
- func (t TestMysqlClient) Close() error
- func (t TestMysqlClient) GetVitessShards(ctx context.Context, psc PlanetScaleSource) ([]string, error)
- func (t TestMysqlClient) PingContext(ctx context.Context, source PlanetScaleSource) error
- type UpdatedRow
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BuildSchemaFunc ¶
type BuildSchemaFunc func(ctx context.Context, psc PlanetScaleSource, schemaBuilder SchemaBuilder) error
type CanConnectFunc ¶
type CanConnectFunc func(ctx context.Context, ps PlanetScaleSource) error
type ConnectClient ¶
type ConnectClient interface { CanConnect(ctx context.Context, ps PlanetScaleSource) error Read(ctx context.Context, logger DatabaseLogger, ps PlanetScaleSource, tableName string, columns []string, lastKnownPosition *psdbconnect.TableCursor, onResult OnResult, onCursor OnCursor, onUpdate OnUpdate) (*SerializedCursor, error) ListShards(ctx context.Context, ps PlanetScaleSource) ([]string, error) }
ConnectClient is a general purpose interface that defines all the data access methods needed for the PlanetScale Fivetran source to function.
func NewConnectClient ¶
func NewConnectClient(mysqlAccess *MysqlClient) ConnectClient
func NewTestConnectClient ¶
func NewTestConnectClient(r ReadFunc) ConnectClient
type DatabaseLogger ¶
type DatabaseLogger interface {
Info(string)
}
type GetVitessShardsFunc ¶
type GetVitessShardsFunc func(ctx context.Context, psc PlanetScaleSource) ([]string, error)
type KeyspaceState ¶
type KeyspaceState struct {
Streams map[string]ShardStates `json:"streams"`
}
type ListShardsFunc ¶
type ListShardsFunc func(ctx context.Context, ps PlanetScaleSource) ([]string, error)
type MysqlClient ¶
type MysqlClient interface { BuildSchema(ctx context.Context, psc PlanetScaleSource, schemaBuilder SchemaBuilder) error PingContext(context.Context, PlanetScaleSource) error GetVitessShards(ctx context.Context, psc PlanetScaleSource) ([]string, error) Close() error }
func NewMySQL ¶
func NewMySQL(psc *PlanetScaleSource) (MysqlClient, error)
type MysqlColumn ¶
type OnCursor ¶
type OnCursor func(*psdbconnect.TableCursor) error
type OnUpdate ¶
type OnUpdate func(*UpdatedRow) error
type PingContextFunc ¶
type PingContextFunc func(context.Context, PlanetScaleSource) error
type PlanetScaleSource ¶
type PlanetScaleSource struct { Host string `json:"host"` Database string `json:"database"` Username string `json:"username"` Password string `json:"password"` Shards string `json:"shards"` TreatTinyIntAsBoolean bool `json:"treat_tiny_int_as_boolean"` UseReplica bool `json:"use_replica"` }
PlanetScaleSource defines a configured Fivetran Source for a PlanetScale database Consider this a connection string to a PlanetScale database.
func (PlanetScaleSource) DSN ¶
func (psc PlanetScaleSource) DSN(tt psdbconnect.TabletType) string
DSN returns a DataSource that mysql libraries can use to connect to a PlanetScale database.
func (PlanetScaleSource) GetInitialState ¶
func (psc PlanetScaleSource) GetInitialState(keyspaceOrDatabase string, shards []string) (ShardStates, error)
GetInitialState will return the initial/blank state for a given keyspace in all of its shards. This state can be round-tripped safely with Fivetran.
type ReadFunc ¶
type ReadFunc func(ctx context.Context, logger DatabaseLogger, ps PlanetScaleSource, tableName string, columns []string, tc *psdbconnect.TableCursor, onResult OnResult, onCursor OnCursor, onUpdate OnUpdate) (*SerializedCursor, error)
type SchemaBuilder ¶
type SchemaBuilder interface { OnKeyspace(keyspaceName string) OnTable(keyspaceName, tableName string) OnColumns(keyspaceName, tableName string, columns []MysqlColumn) }
type SerializedCursor ¶
type SerializedCursor struct {
Cursor string `json:"cursor"`
}
func TableCursorToSerializedCursor ¶
func TableCursorToSerializedCursor(cursor *psdbconnect.TableCursor) (*SerializedCursor, error)
func (SerializedCursor) SerializedCursorToTableCursor ¶
func (s SerializedCursor) SerializedCursorToTableCursor() (*psdbconnect.TableCursor, error)
type ShardStates ¶
type ShardStates struct {
Shards map[string]*SerializedCursor `json:"shards"`
}
type SyncState ¶
type SyncState struct {
Keyspaces map[string]KeyspaceState `json:"keyspaces"`
}
type TestConnectClient ¶
type TestConnectClient struct { ReadFn ReadFunc CanConnectFn CanConnectFunc ListShardsFn ListShardsFunc }
func (*TestConnectClient) CanConnect ¶
func (tcc *TestConnectClient) CanConnect(ctx context.Context, ps PlanetScaleSource) error
func (*TestConnectClient) ListShards ¶
func (tcc *TestConnectClient) ListShards(ctx context.Context, ps PlanetScaleSource) ([]string, error)
func (*TestConnectClient) Read ¶
func (tcc *TestConnectClient) Read(ctx context.Context, logger DatabaseLogger, ps PlanetScaleSource, tableName string, columns []string, lastKnownPosition *psdbconnect.TableCursor, onResult OnResult, onCursor OnCursor, onUpdate OnUpdate) (*SerializedCursor, error)
type TestMysqlClient ¶
type TestMysqlClient struct { BuildSchemaFn BuildSchemaFunc PingContextFn PingContextFunc GetVitessShardsFn GetVitessShardsFunc }
func (TestMysqlClient) BuildSchema ¶
func (t TestMysqlClient) BuildSchema(ctx context.Context, psc PlanetScaleSource, schemaBuilder SchemaBuilder) error
func (TestMysqlClient) Close ¶
func (t TestMysqlClient) Close() error
func (TestMysqlClient) GetVitessShards ¶
func (t TestMysqlClient) GetVitessShards(ctx context.Context, psc PlanetScaleSource) ([]string, error)
func (TestMysqlClient) PingContext ¶
func (t TestMysqlClient) PingContext(ctx context.Context, source PlanetScaleSource) error
Click to show internal directories.
Click to hide internal directories.