device

package
v1.0.0-alpha Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const AggregateID int8 = 6

AggregateID is the global AggregateID for Device Aggregate.

View Source
const DatabaseError = 3

DatabaseError is when some operation related to Database, such as insert or find, goes wrong and the task cannot proceed.

View Source
const InternalError = 2

InternalError represents an error when something goes wrong, and its our fault.

View Source
const UserError = 4

UserError occurs when there's an error because of user's action. An example would be providing devicealid input.

Variables

This section is empty.

Functions

func Delete

func Delete(collection *mongo.Collection, event *model.Event) *model.KafkaResponse

Delete handles "delete" events.

func Insert

func Insert(collection *mongo.Collection, event *model.Event) *model.KafkaResponse

Insert handles "insert" events.

func Update

func Update(collection *mongo.Collection, event *model.Event) *model.KafkaResponse

Update handles "update" events.

Types

type Device

type Device struct {
	ID              objectid.ObjectID `bson:"_id,omitempty" json:"_id,omitempty"`
	ItemID          uuuid.UUID        `bson:"itemID,omitempty" json:"itemID,omitempty"`
	DeviceID        uuuid.UUID        `bson:"deviceID,omitempty" json:"deviceID,omitempty"`
	DateInstalled   int64             `bson:"dateInstalled,omitempty" json:"dateInstalled,omitempty"`
	Lot             string            `bson:"lot,omitempty" json:"lot,omitempty"`
	LastMaintenance int64             `bson:"lastMaintenance,omitempty" json:"lastMaintenance,omitempty"`
	Name            string            `bson:"name,omitempty" json:"name,omitempty"`
	Status          string            `bson:"status,omitempty" json:"status,omitempty"`
	SKU             string            `bson:"sku,omitempty" json:"sku,omitempty"`
}

Device defines the Device Aggregate.

func (Device) MarshalBSON

func (d Device) MarshalBSON() ([]byte, error)

MarshalBSON returns bytes of BSON-type.

func (*Device) MarshalJSON

func (d *Device) MarshalJSON() ([]byte, error)

MarshalJSON returns bytes of JSON-type.

func (*Device) UnmarshalBSON

func (d *Device) UnmarshalBSON(in []byte) error

UnmarshalBSON returns BSON-type from bytes.

func (*Device) UnmarshalJSON

func (d *Device) UnmarshalJSON(in []byte) error

UnmarshalJSON returns JSON-type from bytes.

Jump to

Keyboard shortcuts

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