connector

package module
v0.0.0-...-af13065 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 31, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadEvents

func LoadEvents(connector Connector, dataSource string, orderColumn string)

func WriteEvents

func WriteEvents(pool *pgxpool.Pool, study string, events <-chan *InferenceDataEvent) (int, error)

Types

type Config

type Config struct {
	DB string `env:"PG_URL,required"` // postgres://user:password@host:port/db

}

type Connector

type Connector interface {
	Handler(source *Source, lastEvent *InferenceDataEvent) <-chan *InferenceDataEvent
}

type DataSourceConf

type DataSourceConf []*SourceConf

DB reprsentation of configuration of data sources for a study

type InferenceDataEvent

type InferenceDataEvent struct {
	User       User            `json:"user"`
	Study      string          `json:"study"`
	SourceConf *SourceConf     `json:"source_conf"`
	Timestamp  time.Time       `json:"timestamp"`
	Variable   string          `json:"variable"`
	Value      json.RawMessage `json:"value"`
	Idx        int             `json:"idx"`
	Pagination string          `json:"pagination"`
}

func LastEvent

func LastEvent(pool *pgxpool.Pool, source *Source, orderBy string) (*InferenceDataEvent, bool, error)

type Source

type Source struct {
	StudyID string
	Conf    *SourceConf
}

func GetStudyConfs

func GetStudyConfs(pool *pgxpool.Pool, dataSource string) ([]*Source, error)

type SourceConf

type SourceConf struct {
	Name   string          `json:"name"`
	Source string          `json:"source"`
	Config json.RawMessage `json:"config"`
}

type User

type User struct {
	ID       string                     `json:"id"`
	Metadata map[string]json.RawMessage `json:"metadata"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL