models

package
v0.0.0-...-a5cc226 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Licensed under the Apache License, Version 2.0 (the "License"); you may not use p file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use p file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use p file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use p file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use p file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use p file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use p file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use p file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use p file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use p file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use p file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	JsonType = "json"
	YamlType = "yaml"
)
View Source
const (
	ProjectStatus_Active   = "active"
	ProjectStatus_Inactive = "inactive"
)

Variables

View Source
var (
	InvalidModelError      = newModelError("invalid model '%s'")
	InvalidBundleKindError = newModelError("invalid model bundle '%s'")
	InvalidBundleError     = newModelError("invalid bundle '%s'")
	InvalidParameterError  = newModelError("invalid parameter '%s'")
)

Functions

This section is empty.

Types

type AddProjectNotify

type AddProjectNotify struct {
	ProjectId string
}

type AddTrackpointNotify

type AddTrackpointNotify struct {
	Trackpoint lbs.TrackPoint
	ProjectId  string
	DeviceId   string
	DeviceName string
}

type Bundle

type Bundle interface {
	ContentType() BundleContentType
	Content() []byte
	Kind() BundleKind
	Name() string
}

func NewBundle

func NewBundle(name string, kind BundleKind, data []byte, contentType BundleContentType) Bundle

type BundleContentType

type BundleContentType string
const (
	ContentTypeYaml    BundleContentType = "yaml"
	ContentTypeJson    BundleContentType = "json"
	ContentTypeInvalid BundleContentType = "invalid"
)

func ContentTypeWithNameSuffix

func ContentTypeWithNameSuffix(name string) BundleContentType

type BundleKind

type BundleKind string
const (
	BundleKindPresentation BundleKind = "ModelPresentation"
	BundleKindDefinition   BundleKind = "ModelDefinition"
)

type DataModel

type DataModel struct {
	Name   string            `json:"name"`
	Id     string            `json:"id"`
	Domain string            `json:"domain"`
	Fields []*DataModelField `json:"fields"`
}

func NewDataModel

func NewDataModel() *DataModel

func (*DataModel) AddField

func (m *DataModel) AddField(field *DataModelField)

func (*DataModel) WithDomain

func (m *DataModel) WithDomain(domain string) *DataModel

func (*DataModel) WithName

func (m *DataModel) WithName(name string) *DataModel

type DataModelField

type DataModelField struct {
	Key          string `json:"key"`
	Value        string `json:"value"`
	Type         string `json:"type"`
	DefaultValue string `json:"defaultValue"`
}

func NewDataModelField

func NewDataModelField(key string, tp string, defaultValue string) *DataModelField

type DeleteProjectNotify

type DeleteProjectNotify struct {
	ProjectId string
}

type DeviceModel

type DeviceModel struct {
	Name        string       `json:"name" bson:"name"`
	Id          string       `json:"id" bson:"id"`
	Description string       `json:"description" bson:"description"`
	Domain      string       `json:"domain" bson:"domain"`
	Version     string       `json:"version" bson:"version"`
	Endpoints   []*Endpoint  `json:"endpoints" bson:"endpoints"`
	DataModels  []*DataModel `json:"dataModel" bson:"dataModels"`
	IsLogical   bool         `json:"isLogical" bson:"isLogical"`
	IsCompound  bool         `json:"isCompound" bson:"isCompound"`
	ChildModels []string     `json:"childModels" bson:"childModels"`
	IsPreset    bool         `json:"isPreset" bson:"isPreset"`
	UserId      string       `json:"userId" bson:"userId"`
	CreatedAt   time.Time    `json"createdAt" bson:"createdAt"`
	UpdatedAt   time.Time    `json:"updatedAt" bson:"updatedAt"`
	Icon        string       `json:"icon" bson:"icon"`
}

func NewDeviceModel

func NewDeviceModel() *DeviceModel

func (*DeviceModel) AddDataModel

func (m *DeviceModel) AddDataModel(dataModel *DataModel)

func (*DeviceModel) AddEndpoint

func (m *DeviceModel) AddEndpoint(ep *Endpoint)

func (*DeviceModel) WithChildModels

func (m *DeviceModel) WithChildModels(models []string) *DeviceModel

func (*DeviceModel) WithCompound

func (m *DeviceModel) WithCompound(compound bool) *DeviceModel

func (*DeviceModel) WithDescription

func (m *DeviceModel) WithDescription(description string) *DeviceModel

func (*DeviceModel) WithDomain

func (m *DeviceModel) WithDomain(domain string) *DeviceModel

func (*DeviceModel) WithIcon

func (m *DeviceModel) WithIcon(icon string) *DeviceModel

func (*DeviceModel) WithLogical

func (m *DeviceModel) WithLogical(logical bool) *DeviceModel

func (*DeviceModel) WithName

func (m *DeviceModel) WithName(name string) *DeviceModel

func (*DeviceModel) WithVersion

func (m *DeviceModel) WithVersion(version string) *DeviceModel

type Endpoint

type Endpoint struct {
	Path   string            `json:"path"`
	Format string            `json:"format"`
	Models map[string]string `json:"models"`
}

func NewEndpoint

func NewEndpoint() *Endpoint

func (*Endpoint) WithDataModel

func (ep *Endpoint) WithDataModel(modelName string, direction string) *Endpoint

func (*Endpoint) WithFormat

func (ep *Endpoint) WithFormat(format string) *Endpoint

func (*Endpoint) WithPath

func (ep *Endpoint) WithPath(path string) *Endpoint

type ModelError

type ModelError struct {
	// contains filtered or unexported fields
}

func (ModelError) Error

func (m ModelError) Error() string

func (*ModelError) With

func (m *ModelError) With(v ...interface{}) error

type Project

type Project struct {
	Id            string `json:"id"`
	Name          string `json:"name"`
	UserId        string `json:"user_id"`
	Description   string `json:"description"`
	CreatedAt     string `json:"created_at"`
	LastUpdatedAt string `json:"last_updated_at"`
	Status        string `json:"status"`
}

func (Project) MarshalJSON

func (p Project) MarshalJSON() ([]byte, error)

Custom JSON marshaling to trun empty strings into null pointers

func (Project) String

func (p Project) String() string

func (Project) Validate

func (p Project) Validate(formats strfmt.Registry) error

Validate validates this project

type Reader

type Reader interface {
	Name() string
	Config() map[string]interface{}
	Start() error
	RegisterObserver(ReaderObserver)
	GracefulShutdown() error
}

type ReaderObserver

type ReaderObserver interface {
	OnDataAvailable(Reader, []byte, interface{})
}

type UpdateProjectNotify

type UpdateProjectNotify struct {
	ProjectId string
}

type Widget

type Widget struct {
	Name       string       `json:"name" bson:"name"`
	Id         string       `json:"id" bson:"id"`
	Domain     string       `json:"domain" bson:"domain"`
	Version    string       `json:"version" bson:"version"`
	Endpoints  []*Endpoint  `json:"endpoints" bson:"endpoints"`
	DataModels []*DataModel `json:"dataModel" bson:"dataModels"`
	IsLogical  bool         `json:"isLogical" bson:"isLogical"`
	IsCompound bool         `json:"isCompound" bson:"isCompound"`
	IsPreset   bool         `json:"isPreset" bson:"isPreset"`
	Icon       string       `json:"icon" bson:"icon"`
}

func NewWidgetWithDeviceModel

func NewWidgetWithDeviceModel(m *DeviceModel) *Widget

type WidgetList

type WidgetList struct {
	Widgets map[string][]*Widget `json:"widgets" bson:"widgets"`
}

func NewWidgetList

func NewWidgetList() *WidgetList

func (*WidgetList) Add

func (wl *WidgetList) Add(widgets ...*Widget)

func (*WidgetList) AddUserWidget

func (wl *WidgetList) AddUserWidget(widgets ...*Widget)

func (*WidgetList) Count

func (wl *WidgetList) Count() int

func (*WidgetList) CountOfDomain

func (wl *WidgetList) CountOfDomain(domain string) int

func (*WidgetList) Remove

func (wl *WidgetList) Remove(domain string, widgetName string)

func (*WidgetList) RemoveUserWidget

func (wl *WidgetList) RemoveUserWidget(widgetName string)

Directories

Path Synopsis
Licensed under the Apache License, Version 2.0 (the "License"); you may not use p file except in compliance with the License.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use p file except in compliance with the License.

Jump to

Keyboard shortcuts

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