Documentation ¶
Index ¶
- type BatchInfo
- type Config
- type DataLayerService
- type DataLayerServiceFactory
- type Dataset
- type DatasetDefinition
- type DatasetDescription
- type DatasetWriter
- type EntityIterator
- type EntityToItemPropertyMapping
- type IncomingMappingConfig
- type Item
- type ItemToEntityPropertyMapping
- type LayerError
- type LayerErrorType
- type LayerServiceConfig
- type Logger
- type Mapper
- func (mapper *Mapper) MapEntityToItem(entity *egdm.Entity, item Item) error
- func (mapper *Mapper) MapItemToEntity(item Item, entity *egdm.Entity) error
- func (mapper *Mapper) WithEntityToItemTransform(transform func(entity *egdm.Entity, item Item) error) *Mapper
- func (mapper *Mapper) WithItemToEntityTransform(transform func(item Item, entity *egdm.Entity) error) *Mapper
- type Metrics
- type NativeSystemConfig
- type OutgoingMappingConfig
- type PropertyConstructor
- type ServiceRunner
- func (serviceRunner *ServiceRunner) Start() error
- func (serviceRunner *ServiceRunner) StartAndWait()
- func (serviceRunner *ServiceRunner) Stop() error
- func (serviceRunner *ServiceRunner) WithConfigLocation(configLocation string) *ServiceRunner
- func (serviceRunner *ServiceRunner) WithEnrichConfig(enrichConfig func(config *Config) error) *ServiceRunner
- type StatsdMetrics
- type Stoppable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { ConfigPath string // set by service runner NativeSystemConfig NativeSystemConfig `json:"system_config"` LayerServiceConfig *LayerServiceConfig `json:"layer_config"` DatasetDefinitions []*DatasetDefinition `json:"dataset_definitions"` }
func (*Config) GetDatasetDefinition ¶
func (c *Config) GetDatasetDefinition(dataset string) *DatasetDefinition
type DataLayerService ¶
type DataLayerService interface { Stoppable UpdateConfiguration(config *Config) LayerError Dataset(dataset string) (Dataset, LayerError) DatasetDescriptions() []*DatasetDescription }
type DataLayerServiceFactory ¶
type DataLayerServiceFactory interface {
Build(config *Config, logger Logger, metrics Metrics) (DataLayerService, error)
}
type Dataset ¶
type Dataset interface { MetaData() map[string]any Name() string FullSync(ctx context.Context, batchInfo BatchInfo) (DatasetWriter, LayerError) Incremental(ctx context.Context) (DatasetWriter, LayerError) Changes(since string, take int, latestOnly bool) (EntityIterator, LayerError) Entities(since string, take int) (EntityIterator, LayerError) }
type DatasetDefinition ¶
type DatasetDefinition struct { DatasetName string `json:"name"` SourceConfig map[string]any `json:"source_config"` IncomingMappingConfig *IncomingMappingConfig `json:"incoming_mapping_config"` OutgoingMappingConfig *OutgoingMappingConfig `json:"outgoing_mapping_config"` }
type DatasetDescription ¶ added in v0.1.1
type DatasetWriter ¶
type DatasetWriter interface { Write(entity *egdm.Entity) LayerError Close() LayerError }
type EntityIterator ¶
type EntityIterator interface { Context() *egdm.Context Next() (*egdm.Entity, LayerError) Token() (*egdm.Continuation, LayerError) Close() LayerError }
type EntityToItemPropertyMapping ¶
type EntityToItemPropertyMapping struct { Custom map[string]any Required bool `json:"required"` EntityProperty string `json:"entity_property"` Property string `json:"property"` Datatype string `json:"datatype"` IsReference bool `json:"is_reference"` IsIdentity bool `json:"is_identity"` DefaultValue string `json:"default_value"` StripReferencePrefix bool `json:"strip_ref_prefix"` }
type IncomingMappingConfig ¶
type IncomingMappingConfig struct { MapNamed bool `json:"map_named"` // if true then try and lookup entity properties based on the item property name and the BaseURI prefix PropertyMappings []*EntityToItemPropertyMapping `json:"property_mappings"` BaseURI string `json:"base_uri"` Custom map[string]any `json:"custom"` }
type Item ¶
type Item interface { // GetValue returns the value of the property with the given name GetValue(name string) any // SetValue sets the value of the property with the given name SetValue(name string, value any) // NativeItem returns the underlying native item NativeItem() any // GetPropertyNames returns the names of all properties in the item GetPropertyNames() []string }
type ItemToEntityPropertyMapping ¶
type ItemToEntityPropertyMapping struct { Custom map[string]any Required bool `json:"required"` EntityProperty string `json:"entity_property"` Property string `json:"property"` Datatype string `json:"datatype"` IsReference bool `json:"is_reference"` UrlValuePattern string `json:"url_value_pattern"` IsIdentity bool `json:"is_identity"` DefaultValue any `json:"default_value"` }
type LayerError ¶
func Err ¶
func Err(err error, errType LayerErrorType) LayerError
func Errorf ¶
func Errorf(errType LayerErrorType, format string, args ...any) LayerError
type LayerErrorType ¶
type LayerErrorType int
const ( LayerErrorBadParameter LayerErrorType = iota LayerErrorInternal LayerNotSupported )
type LayerServiceConfig ¶
type LayerServiceConfig struct { ServiceName string `json:"service_name"` Port string `json:"port"` ConfigRefreshInterval string `json:"config_refresh_interval"` LogLevel string `json:"log_level"` LogFormat string `json:"log_format"` StatsdEnabled bool `json:"statsd_enabled"` StatsdAgentAddress string `json:"statsd_agent_address"` Custom map[string]any `json:"custom"` }
type Mapper ¶
type Mapper struct {
// contains filtered or unexported fields
}
func NewMapper ¶
func NewMapper(logger Logger, incomingMappingConfig *IncomingMappingConfig, outgoingMappingConfig *OutgoingMappingConfig) *Mapper
func (*Mapper) MapEntityToItem ¶
func (*Mapper) MapItemToEntity ¶
func (*Mapper) WithEntityToItemTransform ¶
type Metrics ¶
type Metrics interface { Incr(s string, tags []string, i int) LayerError Timing(s string, timed time.Duration, tags []string, i int) LayerError Gauge(s string, f float64, tags []string, i int) LayerError }
type NativeSystemConfig ¶
type OutgoingMappingConfig ¶
type OutgoingMappingConfig struct { BaseURI string `json:"base_uri"` // used when mapping all Constructions []*PropertyConstructor `json:"constructions"` PropertyMappings []*ItemToEntityPropertyMapping `json:"property_mappings"` MapAll bool `json:"map_all"` // if true, all properties are mapped Custom map[string]any `json:"custom"` }
type PropertyConstructor ¶
type PropertyConstructor struct { PropertyName string `json:"property"` Operation string `json:"operation"` Arguments []string `json:"args"` }
the operations can be one of the following: concat, split, replace, trim, tolower, toupper, regex, slice
type ServiceRunner ¶
type ServiceRunner struct {
// contains filtered or unexported fields
}
func NewServiceRunner ¶
func NewServiceRunner(newLayerService func(config *Config, logger Logger, metrics Metrics) (DataLayerService, error)) *ServiceRunner
func (*ServiceRunner) Start ¶
func (serviceRunner *ServiceRunner) Start() error
func (*ServiceRunner) StartAndWait ¶
func (serviceRunner *ServiceRunner) StartAndWait()
func (*ServiceRunner) Stop ¶
func (serviceRunner *ServiceRunner) Stop() error
func (*ServiceRunner) WithConfigLocation ¶
func (serviceRunner *ServiceRunner) WithConfigLocation(configLocation string) *ServiceRunner
func (*ServiceRunner) WithEnrichConfig ¶
func (serviceRunner *ServiceRunner) WithEnrichConfig(enrichConfig func(config *Config) error) *ServiceRunner
type StatsdMetrics ¶
type StatsdMetrics struct {
// contains filtered or unexported fields
}
func (StatsdMetrics) Gauge ¶
func (sm StatsdMetrics) Gauge(name string, value float64, tags []string, rate int) LayerError
func (StatsdMetrics) Incr ¶
func (sm StatsdMetrics) Incr(name string, tags []string, rate int) LayerError
func (StatsdMetrics) Timing ¶
func (sm StatsdMetrics) Timing(name string, value time.Duration, tags []string, rate int) LayerError
Source Files ¶
Click to show internal directories.
Click to hide internal directories.