data

package
v1.20.1-dexcom-api-val... Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2017 License: BSD-3-Clause Imports: 15 Imported by: 50

Documentation

Index

Constants

View Source
const (
	SchemaVersionCurrent = 3 // DEPRECATED

	ComputerTimeFormat = "2006-01-02T15:04:05"
	TimeFormat         = "2006-01-02T15:04:05Z07:00"

	DataSetTypeContinuous = "continuous"
	DataSetTypeNormal     = "normal" // TODO: Normal?

	DataSetStateClosed = "closed"
	DataSetStateOpen   = "open"

	DeviceTagBGM         = "bgm"
	DeviceTagCGM         = "cgm"
	DeviceTagInsulinPump = "insulin-pump"

	TimeProcessingAcrossTheBoardTimezone = "across-the-board-timezone"
	TimeProcessingNone                   = "none"
	TimeProcessingUTCBootstrapping       = "utc-bootstrapping"
)
View Source
const (
	DataSourceStateConnected    = "connected"
	DataSourceStateDisconnected = "disconnected"
	DataSourceStateError        = "error"
)

Variables

Functions

This section is empty.

Types

type ArrayParser

type ArrayParser interface {
	Logger() log.Logger

	SetMeta(meta interface{})

	AppendError(reference interface{}, err *service.Error)

	Array() *[]interface{}

	ParseBoolean(index int) *bool
	ParseInteger(index int) *int
	ParseFloat(index int) *float64
	ParseString(index int) *string
	ParseStringArray(index int) *[]string
	ParseObject(index int) *map[string]interface{}
	ParseObjectArray(index int) *[]map[string]interface{}
	ParseInterface(index int) *interface{}
	ParseInterfaceArray(index int) *[]interface{}
	ParseDatum(index int) *Datum
	ParseDatumArray(index int) *[]Datum

	ProcessNotParsed()

	NewChildObjectParser(index int) ObjectParser
	NewChildArrayParser(index int) ArrayParser
}

type Boolean

type Boolean interface {
	Exists() Boolean
	NotExists() Boolean

	True() Boolean
	False() Boolean
}

type Context

type Context interface {
	Logger() log.Logger

	SetMeta(meta interface{})

	ResolveReference(reference interface{}) string

	AppendError(reference interface{}, err *service.Error)

	NewChildContext(reference interface{}) Context
}

type DataSet added in v1.20.0

type DataSet struct {
	Active              bool                      `json:"-" bson:"_active"`
	Annotations         *[]map[string]interface{} `json:"annotations,omitempty" bson:"annotations,omitempty"`
	ArchivedDatasetID   string                    `json:"-" bson:"archivedDatasetId,omitempty"`
	ArchivedTime        string                    `json:"-" bson:"archivedTime,omitempty"`
	ByUser              string                    `json:"byUser,omitempty" bson:"byUser,omitempty"`
	Client              *DataSetClient            `json:"client,omitempty" bson:"client,omitempty"`
	ClockDriftOffset    *int                      `json:"clockDriftOffset,omitempty" bson:"clockDriftOffset,omitempty"`
	ComputerTime        *string                   `json:"computerTime,omitempty" bson:"computerTime,omitempty"`
	ConversionOffset    *int                      `json:"conversionOffset,omitempty" bson:"conversionOffset,omitempty"`
	CreatedTime         string                    `json:"createdTime,omitempty" bson:"createdTime,omitempty"`
	CreatedUserID       string                    `json:"createdUserId,omitempty" bson:"createdUserId,omitempty"`
	DataSetType         *string                   `json:"dataSetType,omitempty" bson:"dataSetType,omitempty"`
	DataState           string                    `json:"-" bson:"_dataState,omitempty"` // TODO: Deprecated DataState (after data migration)
	Deduplicator        *DeduplicatorDescriptor   `json:"-" bson:"_deduplicator,omitempty"`
	DeletedTime         string                    `json:"deletedTime,omitempty" bson:"deletedTime,omitempty"`
	DeletedUserID       string                    `json:"deletedUserId,omitempty" bson:"deletedUserId,omitempty"`
	DeviceID            *string                   `json:"deviceId,omitempty" bson:"deviceId,omitempty"`
	DeviceManufacturers *[]string                 `json:"deviceManufacturers,omitempty" bson:"deviceManufacturers,omitempty"`
	DeviceModel         *string                   `json:"deviceModel,omitempty" bson:"deviceModel,omitempty"`
	DeviceSerialNumber  *string                   `json:"deviceSerialNumber,omitempty" bson:"deviceSerialNumber,omitempty"`
	DeviceTags          *[]string                 `json:"deviceTags,omitempty" bson:"deviceTags,omitempty"`
	DeviceTime          *string                   `json:"deviceTime,omitempty" bson:"deviceTime,omitempty"`
	GUID                string                    `json:"guid,omitempty" bson:"guid,omitempty"`
	ID                  string                    `json:"id,omitempty" bson:"id,omitempty"`
	ModifiedTime        string                    `json:"modifiedTime,omitempty" bson:"modifiedTime,omitempty"`
	ModifiedUserID      string                    `json:"modifiedUserId,omitempty" bson:"modifiedUserId,omitempty"`
	Payload             *map[string]interface{}   `json:"payload,omitempty" bson:"payload,omitempty"`
	SchemaVersion       int                       `json:"-" bson:"_schemaVersion,omitempty"`
	Source              *string                   `json:"source,omitempty" bson:"source,omitempty"`
	State               string                    `json:"-" bson:"_state,omitempty"`
	Time                *string                   `json:"time,omitempty" bson:"time,omitempty"`
	TimeProcessing      *string                   `json:"timeProcessing,omitempty" bson:"timeProcessing,omitempty"`
	Timezone            *string                   `json:"timezone,omitempty" bson:"timezone,omitempty"`
	TimezoneOffset      *int                      `json:"timezoneOffset,omitempty" bson:"timezoneOffset,omitempty"`
	Type                string                    `json:"type,omitempty" bson:"type,omitempty"`
	UploadID            string                    `json:"uploadId,omitempty" bson:"uploadId,omitempty"`
	UserID              string                    `json:"-" bson:"_userId,omitempty"`
	Version             *string                   `json:"version,omitempty" bson:"version,omitempty"`
	VersionInternal     int                       `json:"-" bson:"_version,omitempty"`
}

type DataSetAccessor added in v1.20.0

type DataSetAccessor interface {
	CreateUserDataSet(ctx context.Context, userID string, create *DataSetCreate) (*DataSet, error)
	GetDataSet(ctx context.Context, id string) (*DataSet, error)
	UpdateDataSet(ctx context.Context, id string, update *DataSetUpdate) (*DataSet, error)
	DeleteDataSet(ctx context.Context, id string) error
}

type DataSetClient added in v1.20.0

type DataSetClient struct {
	Name    string `json:"name,omitempty" bson:"name,omitempty"`
	Version string `json:"version,omitempty" bson:"version,omitempty"`
}

func NewDataSetClient added in v1.20.0

func NewDataSetClient() *DataSetClient

func (*DataSetClient) Parse added in v1.20.0

func (d *DataSetClient) Parse(parser structure.ObjectParser)

func (*DataSetClient) Validate added in v1.20.0

func (d *DataSetClient) Validate(validator structure.Validator)

type DataSetCreate added in v1.20.0

type DataSetCreate struct {
	Client              *DataSetClient `json:"client,omitempty"`
	DataSetType         string         `json:"dataSetType,omitempty"`
	DeviceID            string         `json:"deviceId,omitempty"`
	DeviceManufacturers []string       `json:"deviceManufacturers,omitempty"`
	DeviceModel         string         `json:"deviceModel,omitempty"`
	DeviceSerialNumber  string         `json:"deviceSerialNumber,omitempty"`
	DeviceTags          []string       `json:"deviceTags,omitempty"`
	Time                time.Time      `json:"time,omitempty"`
	Type                string         `json:"type,omitempty"`
	TimeProcessing      string         `json:"timeProcessing,omitempty"`
	Timezone            string         `json:"timezone,omitempty"`
	TimezoneOffset      int            `json:"timezoneOffset,omitempty"`
}

func NewDataSetCreate added in v1.20.0

func NewDataSetCreate() *DataSetCreate

func (*DataSetCreate) Normalize added in v1.20.0

func (d *DataSetCreate) Normalize(normalizer structure.Normalizer)

func (*DataSetCreate) Parse added in v1.20.0

func (d *DataSetCreate) Parse(parser structure.ObjectParser)

func (*DataSetCreate) Validate added in v1.20.0

func (d *DataSetCreate) Validate(validator structure.Validator)

type DataSetUpdate added in v1.20.0

type DataSetUpdate struct {
	Active             *bool                   `json:"-"`
	DeviceID           *string                 `json:"deviceId,omitempty"`
	DeviceModel        *string                 `json:"deviceModel,omitempty"`
	DeviceSerialNumber *string                 `json:"deviceSerialNumber,omitempty"`
	Deduplicator       *DeduplicatorDescriptor `json:"-"`
	State              *string                 `json:"state,omitempty"`
	Time               *time.Time              `json:"time,omitempty"`
	Timezone           *string                 `json:"timezone,omitempty"`
	TimezoneOffset     *int                    `json:"timezoneOffset,omitempty"`
}

func NewDataSetUpdate added in v1.20.0

func NewDataSetUpdate() *DataSetUpdate

func (*DataSetUpdate) HasUpdates added in v1.20.0

func (d *DataSetUpdate) HasUpdates() bool

func (*DataSetUpdate) Parse added in v1.20.0

func (d *DataSetUpdate) Parse(parser structure.ObjectParser)

func (*DataSetUpdate) Validate added in v1.20.0

func (d *DataSetUpdate) Validate(validator structure.Validator)

type DataSets added in v1.20.0

type DataSets []*DataSet

type DataSource added in v1.20.0

type DataSource struct {
	ID                string               `json:"id" bson:"id"`
	UserID            string               `json:"userId" bson:"userId"`
	ProviderType      string               `json:"providerType" bson:"providerType"`
	ProviderName      string               `json:"providerName" bson:"providerName"`
	ProviderSessionID *string              `json:"providerSessionId,omitempty" bson:"providerSessionId,omitempty"`
	State             string               `json:"state,omitempty" bson:"state,omitempty"`
	Error             *errors.Serializable `json:"error,omitempty" bson:"error,omitempty"`
	DataSetIDs        []string             `json:"dataSetIds,omitempty" bson:"dataSetIds,omitempty"`
	EarliestDataTime  *time.Time           `json:"earliestDataTime,omitempty" bson:"earliestDataTime,omitempty"`
	LatestDataTime    *time.Time           `json:"latestDataTime,omitempty" bson:"latestDataTime,omitempty"`
	LastImportTime    *time.Time           `json:"lastImportTime,omitempty" bson:"lastImportTime,omitempty"`
	CreatedTime       time.Time            `json:"createdTime" bson:"createdTime"`
	ModifiedTime      *time.Time           `json:"modifiedTime,omitempty" bson:"modifiedTime,omitempty"`
}

func NewDataSource added in v1.20.0

func NewDataSource(userID string, create *DataSourceCreate) (*DataSource, error)

func (*DataSource) Normalize added in v1.20.0

func (d *DataSource) Normalize(normalizer structure.Normalizer)

func (*DataSource) Parse added in v1.20.0

func (d *DataSource) Parse(parser structure.ObjectParser)

func (*DataSource) Sanitize added in v1.20.0

func (d *DataSource) Sanitize(details request.Details) error

func (*DataSource) Validate added in v1.20.0

func (d *DataSource) Validate(validator structure.Validator)

type DataSourceAccessor added in v1.20.0

type DataSourceAccessor interface {
	ListUserDataSources(ctx context.Context, userID string, filter *DataSourceFilter, pagination *page.Pagination) (DataSources, error)
	CreateUserDataSource(ctx context.Context, userID string, create *DataSourceCreate) (*DataSource, error)
	GetDataSource(ctx context.Context, id string) (*DataSource, error)
	UpdateDataSource(ctx context.Context, id string, update *DataSourceUpdate) (*DataSource, error)
	DeleteDataSource(ctx context.Context, id string) error
}

type DataSourceCreate added in v1.20.0

type DataSourceCreate struct {
	ProviderType      string `json:"providerType" bson:"providerType"`
	ProviderName      string `json:"providerName" bson:"providerName"`
	ProviderSessionID string `json:"providerSessionId" bson:"providerSessionId"`
	State             string `json:"state,omitempty" bson:"state,omitempty"`
}

func NewDataSourceCreate added in v1.20.0

func NewDataSourceCreate() *DataSourceCreate

func (*DataSourceCreate) Parse added in v1.20.0

func (d *DataSourceCreate) Parse(parser structure.ObjectParser)

func (*DataSourceCreate) Validate added in v1.20.0

func (d *DataSourceCreate) Validate(validator structure.Validator)

type DataSourceFilter added in v1.20.0

type DataSourceFilter struct {
	ProviderType      *string `json:"providerType,omitempty" bson:"providerType,omitempty"`
	ProviderName      *string `json:"providerName,omitempty" bson:"providerName,omitempty"`
	ProviderSessionID *string `json:"providerSessionId,omitempty" bson:"providerSessionId,omitempty"`
	State             *string `json:"state,omitempty" bson:"state,omitempty"`
}

func NewDataSourceFilter added in v1.20.0

func NewDataSourceFilter() *DataSourceFilter

func (*DataSourceFilter) Mutate added in v1.20.0

func (d *DataSourceFilter) Mutate(req *http.Request) error

func (*DataSourceFilter) Parse added in v1.20.0

func (d *DataSourceFilter) Parse(parser structure.ObjectParser)

func (*DataSourceFilter) Validate added in v1.20.0

func (d *DataSourceFilter) Validate(validator structure.Validator)

type DataSourceUpdate added in v1.20.0

type DataSourceUpdate struct {
	State            *string              `json:"state,omitempty" bson:"state,omitempty"`
	Error            *errors.Serializable `json:"error,omitempty" bson:"error,omitempty"`
	DataSetIDs       *[]string            `json:"dataSetIds,omitempty" bson:"dataSetIds,omitempty"`
	EarliestDataTime *time.Time           `json:"earliestDataTime,omitempty" bson:"earliestDataTime,omitempty"`
	LatestDataTime   *time.Time           `json:"latestDataTime,omitempty" bson:"latestDataTime,omitempty"`
	LastImportTime   *time.Time           `json:"lastImportTime,omitempty" bson:"lastImportTime,omitempty"`
}

func NewDataSourceUpdate added in v1.20.0

func NewDataSourceUpdate() *DataSourceUpdate

func (*DataSourceUpdate) HasUpdates added in v1.20.0

func (d *DataSourceUpdate) HasUpdates() bool

func (*DataSourceUpdate) Normalize added in v1.20.0

func (d *DataSourceUpdate) Normalize(normalizer structure.Normalizer)

func (*DataSourceUpdate) Parse added in v1.20.0

func (d *DataSourceUpdate) Parse(parser structure.ObjectParser)

func (*DataSourceUpdate) Validate added in v1.20.0

func (d *DataSourceUpdate) Validate(validator structure.Validator)

type DataSources added in v1.20.0

type DataSources []*DataSource

func (DataSources) Sanitize added in v1.20.0

func (d DataSources) Sanitize(details request.Details) error

type Datum

type Datum interface {
	Init()

	Meta() interface{}

	Parse(parser ObjectParser) error
	Validate(validator Validator) error
	Normalize(normalizer Normalizer) error

	IdentityFields() ([]string, error)

	GetPayload() *map[string]interface{}

	SetUserID(userID string)
	SetDatasetID(datasetID string)
	SetActive(active bool)
	SetDeviceID(deviceID *string)
	SetCreatedTime(createdTime string)
	SetCreatedUserID(createdUserID string)
	SetModifiedTime(modifiedTime string)
	SetModifiedUserID(modifiedUserID string)
	SetDeletedTime(deletedTime string)
	SetDeletedUserID(deletedUserID string)

	DeduplicatorDescriptor() *DeduplicatorDescriptor
	SetDeduplicatorDescriptor(deduplicatorDescriptor *DeduplicatorDescriptor)
}

type Deduplicator added in v1.4.0

type Deduplicator interface {
	Name() string
	Version() string

	RegisterDataset(ctx context.Context) error

	AddDatasetData(ctx context.Context, datasetData []Datum) error
	DeduplicateDataset(ctx context.Context) error

	DeleteDataset(ctx context.Context) error
}

type DeduplicatorDescriptor added in v1.4.0

type DeduplicatorDescriptor struct {
	Name    string `bson:"name,omitempty"`
	Version string `bson:"version,omitempty"`
	Hash    string `bson:"hash,omitempty"`
}

func NewDeduplicatorDescriptor added in v1.5.0

func NewDeduplicatorDescriptor() *DeduplicatorDescriptor

func (*DeduplicatorDescriptor) IsRegisteredWithAnyDeduplicator added in v1.5.0

func (d *DeduplicatorDescriptor) IsRegisteredWithAnyDeduplicator() bool

func (*DeduplicatorDescriptor) IsRegisteredWithNamedDeduplicator added in v1.5.0

func (d *DeduplicatorDescriptor) IsRegisteredWithNamedDeduplicator(name string) bool

func (*DeduplicatorDescriptor) RegisterWithDeduplicator added in v1.8.0

func (d *DeduplicatorDescriptor) RegisterWithDeduplicator(deduplicator Deduplicator) error

type Factory

type Factory interface {
	New(inspector Inspector) (Datum, error)
	Init(inspector Inspector) (Datum, error)
}

type Float

type Float interface {
	Exists() Float
	NotExists() Float

	EqualTo(value float64) Float
	NotEqualTo(value float64) Float

	LessThan(limit float64) Float
	LessThanOrEqualTo(limit float64) Float
	GreaterThan(limit float64) Float
	GreaterThanOrEqualTo(limit float64) Float
	InRange(lowerLimit float64, upperLimit float64) Float

	OneOf(allowedValues []float64) Float
	NotOneOf(disallowedValues []float64) Float
}

type Inspector

type Inspector interface {
	GetProperty(key string) *string
	NewMissingPropertyError(key string) error
	NewInvalidPropertyError(key string, value string, allowedValues []string) error
}

type Integer

type Integer interface {
	Exists() Integer
	NotExists() Integer

	EqualTo(value int) Integer
	NotEqualTo(value int) Integer

	LessThan(limit int) Integer
	LessThanOrEqualTo(limit int) Integer
	GreaterThan(limit int) Integer
	GreaterThanOrEqualTo(limit int) Integer
	InRange(lowerLimit int, upperLimit int) Integer

	OneOf(allowedValues []int) Integer
	NotOneOf(disallowedValues []int) Integer
}

type Interface

type Interface interface {
	Exists() Interface
	NotExists() Interface
}

type InterfaceArray

type InterfaceArray interface {
	Exists() InterfaceArray
	NotExists() InterfaceArray

	Empty() InterfaceArray
	NotEmpty() InterfaceArray

	LengthEqualTo(limit int) InterfaceArray
	LengthNotEqualTo(limit int) InterfaceArray
	LengthLessThan(limit int) InterfaceArray
	LengthLessThanOrEqualTo(limit int) InterfaceArray
	LengthGreaterThan(limit int) InterfaceArray
	LengthGreaterThanOrEqualTo(limit int) InterfaceArray
	LengthInRange(lowerLimit int, upperLimit int) InterfaceArray
}

type Normalizer

type Normalizer interface {
	Logger() log.Logger

	SetMeta(meta interface{})

	AppendError(reference interface{}, err *service.Error)

	AppendDatum(datum Datum)

	NewChildNormalizer(reference interface{}) Normalizer
}

type Object

type Object interface {
	Exists() Object
	NotExists() Object

	Empty() Object
	NotEmpty() Object
}

type ObjectArray

type ObjectArray interface {
	Exists() ObjectArray
	NotExists() ObjectArray

	Empty() ObjectArray
	NotEmpty() ObjectArray

	LengthEqualTo(limit int) ObjectArray
	LengthNotEqualTo(limit int) ObjectArray
	LengthLessThan(limit int) ObjectArray
	LengthLessThanOrEqualTo(limit int) ObjectArray
	LengthGreaterThan(limit int) ObjectArray
	LengthGreaterThanOrEqualTo(limit int) ObjectArray
	LengthInRange(lowerLimit int, upperLimit int) ObjectArray
}

type ObjectParser

type ObjectParser interface {
	Logger() log.Logger

	SetMeta(meta interface{})

	AppendError(reference interface{}, err *service.Error)

	Object() *map[string]interface{}

	ParseBoolean(key string) *bool
	ParseInteger(key string) *int
	ParseFloat(key string) *float64
	ParseString(key string) *string
	ParseStringArray(key string) *[]string
	ParseObject(key string) *map[string]interface{}
	ParseObjectArray(key string) *[]map[string]interface{}
	ParseInterface(key string) *interface{}
	ParseInterfaceArray(key string) *[]interface{}
	ParseDatum(key string) *Datum
	ParseDatumArray(key string) *[]Datum

	ProcessNotParsed()

	NewChildObjectParser(key string) ObjectParser
	NewChildArrayParser(key string) ArrayParser
}

type String

type String interface {
	Exists() String
	NotExists() String

	Empty() String
	NotEmpty() String

	EqualTo(value string) String
	NotEqualTo(value string) String

	LengthEqualTo(limit int) String
	LengthNotEqualTo(limit int) String
	LengthLessThan(limit int) String
	LengthLessThanOrEqualTo(limit int) String
	LengthGreaterThan(limit int) String
	LengthGreaterThanOrEqualTo(limit int) String
	LengthInRange(lowerLimit int, upperLimit int) String

	OneOf(allowedValues []string) String
	NotOneOf(disallowedValues []string) String
}

type StringArray

type StringArray interface {
	Exists() StringArray
	NotExists() StringArray

	Empty() StringArray
	NotEmpty() StringArray

	LengthEqualTo(limit int) StringArray
	LengthNotEqualTo(limit int) StringArray
	LengthLessThan(limit int) StringArray
	LengthLessThanOrEqualTo(limit int) StringArray
	LengthGreaterThan(limit int) StringArray
	LengthGreaterThanOrEqualTo(limit int) StringArray
	LengthInRange(lowerLimit int, upperLimit int) StringArray

	EachOneOf(allowedValues []string) StringArray
	EachNotOneOf(disallowedValues []string) StringArray
}

type Time

type Time interface {
	Exists() Time
	NotExists() Time

	After(limit time.Time) Time
	AfterNow(threshold time.Duration) Time
	Before(limit time.Time) Time
	BeforeNow(threshold time.Duration) Time
}

type Validator

type Validator interface {
	Logger() log.Logger

	SetMeta(meta interface{})

	AppendError(reference interface{}, err *service.Error)

	ValidateBoolean(reference interface{}, value *bool) Boolean
	ValidateInteger(reference interface{}, value *int) Integer
	ValidateFloat(reference interface{}, value *float64) Float
	ValidateString(reference interface{}, value *string) String
	ValidateStringArray(reference interface{}, value *[]string) StringArray
	ValidateObject(reference interface{}, value *map[string]interface{}) Object
	ValidateObjectArray(reference interface{}, value *[]map[string]interface{}) ObjectArray
	ValidateInterface(reference interface{}, value *interface{}) Interface
	ValidateInterfaceArray(reference interface{}, value *[]interface{}) InterfaceArray

	ValidateStringAsTime(reference interface{}, stringValue *string, timeLayout string) Time

	NewChildValidator(reference interface{}) Validator
}

Jump to

Keyboard shortcuts

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