Documentation ¶
Index ¶
- Constants
- Variables
- func NewSource() sdk.Source
- func Specification() sdk.Specification
- type Config
- type CurrentVoyage
- type Dimensions
- type GraphQLClient
- type Iterator
- type IteratorCreator
- type IteratorInterface
- type LastPositionUpdate
- type Node
- type PageInfo
- type Source
- func (s *Source) Ack(ctx context.Context, position opencdc.Position) error
- func (s *Source) Configure(ctx context.Context, cfg config.Config) error
- func (s *Source) GetConfig() SourceConfig
- func (s *Source) Open(ctx context.Context, pos opencdc.Position) error
- func (s *Source) Parameters() config.Parameters
- func (s *Source) Read(ctx context.Context) (opencdc.Record, error)
- func (s *Source) Teardown(ctx context.Context) error
- type SourceConfig
- type SourceIteratorCreator
- type StaticData
- type TotalCount
- type Vessels
Constants ¶
View Source
const ( SourceConfigApiUrl = "apiUrl" SourceConfigBatchSize = "batchSize" SourceConfigQuery = "query" SourceConfigToken = "token" )
Variables ¶
View Source
var Connector = sdk.Connector{ NewSpecification: Specification, NewSource: NewSource, NewDestination: nil, }
Connector combines all constructors for each plugin in one struct.
Functions ¶
func Specification ¶
func Specification() sdk.Specification
Specification returns the connector's specification.
Types ¶
type Config ¶
type Config struct { // APIURL is the Spire API URL to use for accessing the Spire GraphQL API. APIURL string `json:"apiUrl" default:"https://api.spire.com/graphql"` // Token is the access token to use when accessing the Spire GraphQL API. Token string `json:"token" validate:"required"` // batchSize is the quantity of vessels to retrieve per Spire GraphQL API call. BatchSize int `json:"batchSize" default:"100"` }
Config contains shared config parameters, common to the source and destination. If you don't need shared parameters you can entirely remove this file.
type CurrentVoyage ¶
type Dimensions ¶
type GraphQLClient ¶
type GraphQLClient interface {
Run(ctx context.Context, req *graphql.Request, resp interface{}) error
}
Add GraphQLClient interface for dependency injection
type Iterator ¶
type Iterator struct {
// contains filtered or unexported fields
}
Updated Iterator struct with logger and client dependencies
func NewIterator ¶
type IteratorCreator ¶
type IteratorInterface ¶
type LastPositionUpdate ¶
type LastPositionUpdate struct { Accuracy string `json:"accuracy"` CollectionType string `json:"collectionType"` Course float64 `json:"course"` Heading float64 `json:"heading"` Latitude float64 `json:"latitude"` Longitude float64 `json:"longitude"` Maneuver string `json:"maneuver"` Rot float64 `json:"rot"` Speed float64 `json:"speed"` Timestamp string `json:"timestamp"` UpdateTimestamp string `json:"updateTimestamp"` }
type Node ¶
type Node struct { ID string `json:"id"` UpdateTimestamp string `json:"updateTimestamp"` StaticData StaticData `json:"staticData"` LastPositionUpdate LastPositionUpdate `json:"lastPositionUpdate"` CurrentVoyage CurrentVoyage `json:"currentVoyage"` }
type Source ¶
type Source struct { sdk.UnimplementedSource // contains filtered or unexported fields }
func (*Source) GetConfig ¶
func (s *Source) GetConfig() SourceConfig
func (*Source) Parameters ¶
func (s *Source) Parameters() config.Parameters
type SourceConfig ¶
type SourceConfig struct { // Config includes parameters that are the same in the source and destination. Config // Query is the GraphQL Query to use when pulling data from the Spire API. Query string `json:"query"` }
func (SourceConfig) Parameters ¶
func (SourceConfig) Parameters() map[string]config.Parameter
type SourceIteratorCreator ¶
type SourceIteratorCreator struct { }
func (SourceIteratorCreator) NewIterator ¶
func (ic SourceIteratorCreator) NewIterator(client GraphQLClient, token string, query string, batchSize int, p opencdc.Position) (*Iterator, error)
type StaticData ¶
type StaticData struct { AisClass string `json:"aisClass"` Flag string `json:"flag"` Name string `json:"name"` Callsign string `json:"callsign"` Timestamp string `json:"timestamp"` UpdateTimestamp string `json:"updateTimestamp"` ShipType string `json:"shipType"` ShipSubType string `json:"shipSubType"` MMSI int `json:"mmsi"` IMO int `json:"imo"` Dimensions Dimensions `json:"dimensions"` }
type TotalCount ¶
type Vessels ¶
type Vessels struct { PageInfo PageInfo `json:"pageInfo"` TotalCount TotalCount `json:"totalCount"` Nodes []Node `json:"nodes"` }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.