data

package
v0.0.0-...-888d113 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TemperatureSource = "temperature"
)

Variables

This section is empty.

Functions

func NewDataCollector

func NewDataCollector(brokerList []string, certFile *string, keyFile *string, caFile *string, verifySsl *bool) sarama.SyncProducer

func NewDeadLetterProducer

func NewDeadLetterProducer(brokerList []string, certFile *string, keyFile *string, caFile *string, verifySsl *bool) sarama.AsyncProducer

func ValidationError

func ValidationError(errs validator.ValidationErrors) string

Types

type SensorData

type SensorData struct {
	Id         string  `json:"id" validate:"required"`
	Value      float64 `json:"value" validate:"required,gte=-30,lte=100"`
	SourceType string  `json:"source_type" validate:"required"`
}

SensorData stores sensor readings for different source types eg. temperature, light etc.

type Server

type Server struct {
	DataCollector sarama.SyncProducer
	DeadLetter    sarama.AsyncProducer
}

func (*Server) Close

func (s *Server) Close() error

func (*Server) Handler

func (s *Server) Handler(topic string, deadLetter string) http.Handler

func (*Server) Run

func (s *Server) Run(addr string, topic string, deadLetter string) error

Jump to

Keyboard shortcuts

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