fix: update dependancies
This commit is contained in:
		@@ -1,12 +1,19 @@
 | 
			
		||||
package types
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"encoding/json"
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"io"
 | 
			
		||||
	"time"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// Checkpoint ...
 | 
			
		||||
type Checkpoint struct {
 | 
			
		||||
	CheckpointID   string    `json:"checkpoint_id"`
 | 
			
		||||
	CheckpointDate time.Time `json:"checkpoint_date,string"`
 | 
			
		||||
	RFID           string    `json:"rfid"`
 | 
			
		||||
	ProductID      string    `json:"product_id"`
 | 
			
		||||
	SensorID       string    `json:"sensor_id"`
 | 
			
		||||
	CreationDate   time.Time `json:"creation_date"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Device ...
 | 
			
		||||
type Device struct {
 | 
			
		||||
	DeviceID          string    `json:"device_id"`
 | 
			
		||||
@@ -16,26 +23,6 @@ type Device struct {
 | 
			
		||||
	CreationDate      time.Time `json:"creation_date"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// EncodeToJSON needs a writer to write the struct into json string
 | 
			
		||||
func (d *Device) EncodeToJSON(w io.Writer) error {
 | 
			
		||||
	encoder := json.NewEncoder(w)
 | 
			
		||||
	encoder.SetIndent("", "  ")
 | 
			
		||||
	err := encoder.Encode(&d)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return fmt.Errorf("Error in encoding struct to json: %v", err)
 | 
			
		||||
	}
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DecodeFromJSON decode a json string from a reader into a struct
 | 
			
		||||
func (d *Device) DecodeFromJSON(r io.Reader) error {
 | 
			
		||||
	decoder := json.NewDecoder(r)
 | 
			
		||||
	if err := decoder.Decode(&d); err != nil {
 | 
			
		||||
		return fmt.Errorf("Can not unmarshal JSON: %v", err)
 | 
			
		||||
	}
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Failnoise ...
 | 
			
		||||
type Failnoise struct {
 | 
			
		||||
	FailnoiseID        string    `json:"failnoise_id"`
 | 
			
		||||
@@ -46,26 +33,6 @@ type Failnoise struct {
 | 
			
		||||
	CreationDate       time.Time `json:"creation_date"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// EncodeToJSON needs a writer to write the struct into json string
 | 
			
		||||
func (f *Failnoise) EncodeToJSON(w io.Writer) error {
 | 
			
		||||
	encoder := json.NewEncoder(w)
 | 
			
		||||
	encoder.SetIndent("", "  ")
 | 
			
		||||
	err := encoder.Encode(&f)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return fmt.Errorf("Error in encoding struct to json: %v", err)
 | 
			
		||||
	}
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DecodeFromJSON decode a json string from a reader into a struct
 | 
			
		||||
func (f *Failnoise) DecodeFromJSON(r io.Reader) error {
 | 
			
		||||
	decoder := json.NewDecoder(r)
 | 
			
		||||
	if err := decoder.Decode(&f); err != nil {
 | 
			
		||||
		return fmt.Errorf("Can not unmarshal JSON: %v", err)
 | 
			
		||||
	}
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Humidity ...
 | 
			
		||||
type Humidity struct {
 | 
			
		||||
	HumidityID    string    `json:"humidity_id"`
 | 
			
		||||
@@ -75,26 +42,6 @@ type Humidity struct {
 | 
			
		||||
	CreationDate  time.Time `json:"creation_date"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// EncodeToJSON needs a writer to write the struct into json string
 | 
			
		||||
func (h *Humidity) EncodeToJSON(w io.Writer) error {
 | 
			
		||||
	encoder := json.NewEncoder(w)
 | 
			
		||||
	encoder.SetIndent("", "  ")
 | 
			
		||||
	err := encoder.Encode(&h)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return fmt.Errorf("Error in encoding struct to json: %v", err)
 | 
			
		||||
	}
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DecodeFromJSON decode a json string from a reader into a struct
 | 
			
		||||
func (h *Humidity) DecodeFromJSON(r io.Reader) error {
 | 
			
		||||
	decoder := json.NewDecoder(r)
 | 
			
		||||
	if err := decoder.Decode(&h); err != nil {
 | 
			
		||||
		return fmt.Errorf("Can not unmarshal JSON: %v", err)
 | 
			
		||||
	}
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Knock ...
 | 
			
		||||
type Knock struct {
 | 
			
		||||
	KnockID        string    `json:"knock_id"`
 | 
			
		||||
@@ -105,26 +52,6 @@ type Knock struct {
 | 
			
		||||
	CreationDate   time.Time `json:"creation_date"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// EncodeToJSON needs a writer to write the struct into json string
 | 
			
		||||
func (k *Knock) EncodeToJSON(w io.Writer) error {
 | 
			
		||||
	encoder := json.NewEncoder(w)
 | 
			
		||||
	encoder.SetIndent("", "  ")
 | 
			
		||||
	err := encoder.Encode(&k)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return fmt.Errorf("Error in encoding struct to json: %v", err)
 | 
			
		||||
	}
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DecodeFromJSON decode a json string from a reader into a struct
 | 
			
		||||
func (k *Knock) DecodeFromJSON(r io.Reader) error {
 | 
			
		||||
	decoder := json.NewDecoder(r)
 | 
			
		||||
	if err := decoder.Decode(&k); err != nil {
 | 
			
		||||
		return fmt.Errorf("Can not unmarshal JSON: %v", err)
 | 
			
		||||
	}
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Sensor ...
 | 
			
		||||
type Sensor struct {
 | 
			
		||||
	SensorID          string    `json:"sensor_id"`
 | 
			
		||||
@@ -139,26 +66,6 @@ type Sensor struct {
 | 
			
		||||
	CreationDate      time.Time `json:"creation_date"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// EncodeToJSON needs a writer to write the struct into json string
 | 
			
		||||
func (s *Sensor) EncodeToJSON(w io.Writer) error {
 | 
			
		||||
	encoder := json.NewEncoder(w)
 | 
			
		||||
	encoder.SetIndent("", "  ")
 | 
			
		||||
	err := encoder.Encode(&s)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return fmt.Errorf("Error in encoding struct to json: %v", err)
 | 
			
		||||
	}
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DecodeFromJSON decode a json string from a reader into a struct
 | 
			
		||||
func (s *Sensor) DecodeFromJSON(r io.Reader) error {
 | 
			
		||||
	decoder := json.NewDecoder(r)
 | 
			
		||||
	if err := decoder.Decode(&s); err != nil {
 | 
			
		||||
		return fmt.Errorf("Can not unmarshal JSON: %v", err)
 | 
			
		||||
	}
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ReadableSensorName returns a readable sensor name
 | 
			
		||||
func (s *Sensor) ReadableSensorName() string {
 | 
			
		||||
	if s.SensorName != nil {
 | 
			
		||||
@@ -179,26 +86,6 @@ type Temperature struct {
 | 
			
		||||
	CreationDate     time.Time `json:"creation_date"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// EncodeToJSON needs a writer to write the struct into json string
 | 
			
		||||
func (t *Temperature) EncodeToJSON(w io.Writer) error {
 | 
			
		||||
	encoder := json.NewEncoder(w)
 | 
			
		||||
	encoder.SetIndent("", "  ")
 | 
			
		||||
	err := encoder.Encode(&t)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return fmt.Errorf("Error in encoding struct to json: %v", err)
 | 
			
		||||
	}
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DecodeFromJSON decode a json string from a reader into a struct
 | 
			
		||||
func (t *Temperature) DecodeFromJSON(r io.Reader) error {
 | 
			
		||||
	decoder := json.NewDecoder(r)
 | 
			
		||||
	if err := decoder.Decode(&t); err != nil {
 | 
			
		||||
		return fmt.Errorf("Can not unmarshal JSON: %v", err)
 | 
			
		||||
	}
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Throughput ...
 | 
			
		||||
type Throughput struct {
 | 
			
		||||
	ThroughputID        string    `json:"throughput_id"`
 | 
			
		||||
@@ -208,23 +95,3 @@ type Throughput struct {
 | 
			
		||||
	SensorID            string    `json:"sensor_id"`
 | 
			
		||||
	CreationDate        time.Time `json:"creation_date"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// EncodeToJSON needs a writer to write the struct into json string
 | 
			
		||||
func (t *Throughput) EncodeToJSON(w io.Writer) error {
 | 
			
		||||
	encoder := json.NewEncoder(w)
 | 
			
		||||
	encoder.SetIndent("", "  ")
 | 
			
		||||
	err := encoder.Encode(&t)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return fmt.Errorf("Error in encoding struct to json: %v", err)
 | 
			
		||||
	}
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DecodeFromJSON decode a json string from a reader into a struct
 | 
			
		||||
func (t *Throughput) DecodeFromJSON(r io.Reader) error {
 | 
			
		||||
	decoder := json.NewDecoder(r)
 | 
			
		||||
	if err := decoder.Decode(&t); err != nil {
 | 
			
		||||
		return fmt.Errorf("Can not unmarshal JSON: %v", err)
 | 
			
		||||
	}
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										3
									
								
								vendor/github.com/MichaelS11/go-dht/dhtNotWindows.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								vendor/github.com/MichaelS11/go-dht/dhtNotWindows.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -4,7 +4,6 @@ package dht
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"log"
 | 
			
		||||
	"runtime/debug"
 | 
			
		||||
	"strings"
 | 
			
		||||
	"time"
 | 
			
		||||
@@ -93,8 +92,6 @@ func (dht *DHT) readBits() ([]int, error) {
 | 
			
		||||
	// enable garbage collection, done with critical part
 | 
			
		||||
	debug.SetGCPercent(gcPercent)
 | 
			
		||||
 | 
			
		||||
	log.Printf("%v\n", levels)
 | 
			
		||||
 | 
			
		||||
	// set pin to high so ready for next time
 | 
			
		||||
	err = dht.pin.Out(gpio.High)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user