Add amqp support
This commit is contained in:
+21
-1
@@ -1,6 +1,10 @@
|
||||
package yabl
|
||||
|
||||
import "fmt"
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"time"
|
||||
)
|
||||
|
||||
func (t BooleanType) String() string {
|
||||
switch t {
|
||||
@@ -211,3 +215,19 @@ func (t SignedAirTemp8BitType) String() string {
|
||||
func (c ConnectedOut8bitType) String() string {
|
||||
return fmt.Sprintf("%d", c)
|
||||
}
|
||||
|
||||
func (u *Event) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(struct {
|
||||
Unit uint
|
||||
ActionName AName
|
||||
Field FName
|
||||
Updated *time.Time
|
||||
Value string
|
||||
}{
|
||||
Unit: u.GetUnitId(),
|
||||
ActionName: u.ActionName,
|
||||
Field: u.Field,
|
||||
Updated: u.Updated,
|
||||
Value: fmt.Sprintf("%v", u.Value),
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user