Documentation ¶
Index ¶
Constants ¶
const AggregateID int8 = 6
AggregateID is the global AggregateID for Device Aggregate.
const DatabaseError = 3
DatabaseError is when some operation related to Database, such as insert or find, goes wrong and the task cannot proceed.
const InternalError = 2
InternalError represents an error when something goes wrong, and its our fault.
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 ¶
MarshalBSON returns bytes of BSON-type.
func (*Device) MarshalJSON ¶
MarshalJSON returns bytes of JSON-type.
func (*Device) UnmarshalBSON ¶
UnmarshalBSON returns BSON-type from bytes.
func (*Device) UnmarshalJSON ¶
UnmarshalJSON returns JSON-type from bytes.