data

package
v1.33.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2020 License: BSD-2-Clause Imports: 18 Imported by: 50

Documentation

Index

Constants

View Source
const (
	ComputerTimeFormat = "2006-01-02T15:04:05"
	TimeFormat         = time.RFC3339Nano

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

	DataSetStateClosed = "closed"
	DataSetStateOpen   = "open"

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

	TimeProcessingAcrossTheBoardTimeZone = "across-the-board-timezone" // TODO: Rename to across-the-board-time-zone or alternative
	TimeProcessingNone                   = "none"
	TimeProcessingUTCBootstrapping       = "utc-bootstrapping" // TODO: Rename to utc-bootstrap or alternative
)
View Source
const (
	SelectorOriginIDLengthMaximum = 100
)

Variables

This section is empty.

Functions

func DataSetStates added in v1.20.0

func DataSetStates() []string

func DataSetTypes added in v1.20.0

func DataSetTypes() []string

func DeviceTags added in v1.20.0

func DeviceTags() []string

func ErrorValueStringAsIDNotValid added in v1.27.0

func ErrorValueStringAsIDNotValid(value string) error

func ErrorValueStringAsSetIDNotValid added in v1.27.0

func ErrorValueStringAsSetIDNotValid(value string) error

func IDValidator added in v1.27.0

func IDValidator(value string, errorReporter structure.ErrorReporter)

func IsValidID added in v1.27.0

func IsValidID(value string) bool

func IsValidSetID added in v1.27.0

func IsValidSetID(value string) bool

func NewID added in v1.27.0

func NewID() string

func NewSetID added in v1.27.0

func NewSetID() string

func SetIDValidator added in v1.27.0

func SetIDValidator(value string, errorReporter structure.ErrorReporter)

func TimeProcessings added in v1.20.0

func TimeProcessings() []string

func ValidateID added in v1.27.0

func ValidateID(value string) error

func ValidateSetID added in v1.27.0

func ValidateSetID(value string) error

Types

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 Data added in v1.29.0

type Data []Datum

func (Data) SetActive added in v1.29.0

func (d Data) SetActive(active bool)

type DataSet added in v1.20.0

type DataSet struct {
	Active              bool                    `json:"-" bson:"_active"`
	Annotations         *metadata.MetadataArray `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:"deduplicator,omitempty" 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             *metadata.Metadata      `json:"payload,omitempty" bson:"payload,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"`
	TimeZoneName        *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 {
	ListUserDataSets(ctx context.Context, userID string, filter *DataSetFilter, pagination *page.Pagination) (DataSets, error)
	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"`
	Private *map[string]interface{} `json:"private,omitempty" bson:"private,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"`
	Deduplicator        *DeduplicatorDescriptor `json:"deduplicator,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"`
	TimeZoneName        *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 DataSetFilter added in v1.21.0

type DataSetFilter struct {
	ClientName *string
	Deleted    *bool
	DeviceID   *string
}

func NewDataSetFilter added in v1.21.0

func NewDataSetFilter() *DataSetFilter

func (*DataSetFilter) MutateRequest added in v1.27.0

func (d *DataSetFilter) MutateRequest(req *http.Request) error

func (*DataSetFilter) Parse added in v1.21.0

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

func (*DataSetFilter) Validate added in v1.21.0

func (d *DataSetFilter) 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"`
	TimeZoneName       *string                 `json:"timezone,omitempty"`
	TimeZoneOffset     *int                    `json:"timezoneOffset,omitempty"`
}

func NewDataSetUpdate added in v1.20.0

func NewDataSetUpdate() *DataSetUpdate

func (*DataSetUpdate) IsEmpty added in v1.31.0

func (d *DataSetUpdate) IsEmpty() 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 Datum

type Datum interface {
	Meta() interface{}

	Parse(parser structure.ObjectParser)
	Validate(validator structure.Validator)
	Normalize(normalizer Normalizer)

	IdentityFields() ([]string, error)

	GetOrigin() *origin.Origin
	GetPayload() *metadata.Metadata

	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)
}

func DatumAsPointer added in v1.26.0

func DatumAsPointer(datum Datum) *Datum

type DeduplicatorDescriptor added in v1.4.0

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

func NewDeduplicatorDescriptor added in v1.5.0

func NewDeduplicatorDescriptor() *DeduplicatorDescriptor

func ParseDeduplicatorDescriptor added in v1.29.0

func ParseDeduplicatorDescriptor(parser structure.ObjectParser) *DeduplicatorDescriptor

func (*DeduplicatorDescriptor) HasName added in v1.29.0

func (d *DeduplicatorDescriptor) HasName() bool

func (*DeduplicatorDescriptor) HasNameMatch added in v1.29.0

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

func (*DeduplicatorDescriptor) Normalize added in v1.24.0

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

func (*DeduplicatorDescriptor) NormalizeDEPRECATED added in v1.29.0

func (d *DeduplicatorDescriptor) NormalizeDEPRECATED(normalizer Normalizer)

func (*DeduplicatorDescriptor) Parse added in v1.29.0

func (*DeduplicatorDescriptor) Validate added in v1.24.0

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

type Normalizable added in v1.24.0

type Normalizable interface {
	Normalize(normalizer Normalizer)
}

type Normalizer

type Normalizer interface {
	structure.OriginReporter
	structure.SourceReporter
	structure.MetaReporter

	structure.ErrorReporter

	Normalize(normalizable Normalizable) error

	AddData(data ...Datum)

	WithOrigin(origin structure.Origin) Normalizer
	WithSource(source structure.Source) Normalizer
	WithMeta(meta interface{}) Normalizer
	WithReference(reference string) Normalizer
}

type Selector added in v1.29.0

type Selector struct {
	ID     *string         `json:"id,omitempty"`
	Origin *SelectorOrigin `json:"origin,omitempty"`
}

func NewSelector added in v1.29.0

func NewSelector() *Selector

func ParseSelector added in v1.29.0

func ParseSelector(parser structure.ObjectParser) *Selector

func (*Selector) Parse added in v1.29.0

func (s *Selector) Parse(parser structure.ObjectParser)

func (*Selector) Validate added in v1.29.0

func (s *Selector) Validate(validator structure.Validator)

type SelectorOrigin added in v1.29.0

type SelectorOrigin struct {
	ID *string `json:"id,omitempty"`
}

func NewSelectorOrigin added in v1.29.0

func NewSelectorOrigin() *SelectorOrigin

func ParseSelectorOrigin added in v1.29.0

func ParseSelectorOrigin(parser structure.ObjectParser) *SelectorOrigin

func (*SelectorOrigin) Parse added in v1.29.0

func (s *SelectorOrigin) Parse(parser structure.ObjectParser)

func (*SelectorOrigin) Validate added in v1.29.0

func (s *SelectorOrigin) Validate(validator structure.Validator)

type Selectors added in v1.29.0

type Selectors []*Selector

func NewSelectors added in v1.29.0

func NewSelectors() *Selectors

func ParseSelectors added in v1.29.0

func ParseSelectors(parser structure.ArrayParser) *Selectors

func (*Selectors) Parse added in v1.29.0

func (s *Selectors) Parse(parser structure.ArrayParser)

func (*Selectors) Validate added in v1.29.0

func (s *Selectors) Validate(validator structure.Validator)

Jump to

Keyboard shortcuts

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