homehub

package module
v0.0.0-...-bf82383 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2016 License: GPL-3.0 Imports: 5 Imported by: 0

README

home-hub

A home automation package

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GoodSample = Datam{
	Table: "test",
	Data: map[Alphabetic]Field{
		Alphabetic("float"):  Field{Value: 1.0, /* contains filtered or unexported fields */},
		Alphabetic("string"): Field{Value: "str", /* contains filtered or unexported fields */},
		Alphabetic("int"):    Field{Value: 1, /* contains filtered or unexported fields */},
		Alphabetic("bool"):   Field{Value: false, /* contains filtered or unexported fields */},
	},
}

GoodSample is a sample of a good Datam

Functions

This section is empty.

Types

type Alphabetic

type Alphabetic string

Alphabetic is something from a-z and A-Z

func (Alphabetic) Valid

func (a Alphabetic) Valid() bool

Valid returns true only if it contains valid characters

type Attendant

type Attendant interface {
	Use(Backend) //where do we aim messages
	Stop()       //cease operations and exit
}

An Attendant performs the function of listening for data messages and forwarding them to a backend to store

type Backend

type Backend interface {
	Register(Datam) error //registers a datam
	Store(Datam) error    //Stores datam
	Stop()                //cease operations
}

A Backend supports multiple attendants that gather messages by various means

type Datam

type Datam struct {
	Table Alphabetic           `json:"table"`
	Data  map[Alphabetic]Field `json:"data"`
}

Datam is what all insertable things should map to

func (*Datam) Equal

func (d *Datam) Equal(a *Datam) bool

Equal returns true if a is the same as d

func (*Datam) NamedExec

func (d *Datam) NamedExec() (r string, vals map[string]interface{}, err error)

NamedExec returns a SQL statement can be be fed into a sqlx.NamedExec along with a set of matching values, and a non-nil error if it cannot form such a statement.

func (*Datam) SqlCreate

func (d *Datam) SqlCreate(dialect string) (r string, err error)

SQLCreate forms a SQL statement to store the datam into somde database. It will prepend a primary key 'rowid' key, timestamp as createdat and any additional data. Dialect should be one of the following:

  • "sqlite3"
  • "postgres"

Others have yet to be defined, but should be added to fieldmode.sqltype()

func (Datam) Valid

func (d Datam) Valid() bool

Valid is true if the fields in Datam are valid

type Field

type Field struct {
	Value interface{}
	// contains filtered or unexported fields
}

Field is a JSON parsable

func (*Field) UnmarshalJSON

func (f *Field) UnmarshalJSON(incoming []byte) (err error)

UnmarshalJSON conforms to the json.Unmarshaller interface

func (Field) Valid

func (f Field) Valid() bool

Valid returns true if the field captured is valid

type RegStore

type RegStore func(datam Datam) error

The RegStore function call either registers or stores a Datam somewhere

type Stoppable

type Stoppable interface {
	Stop()
}

Stoppable is anything that can be stopped and somehow acts as a proxy to receieve data.

Directories

Path Synopsis
Package attendants holds various wrappers around various protocols in order to expose easier access to storage mechanisms.
Package attendants holds various wrappers around various protocols in order to expose easier access to storage mechanisms.
mangos
Package mango holds various wrappers around various protocols in order to expose easier access to storage mechanisms.
Package mango holds various wrappers around various protocols in order to expose easier access to storage mechanisms.
Package backends are a collection of homehub.Backends that register and store incoming homehub.Datam fields.
Package backends are a collection of homehub.Backends that register and store incoming homehub.Datam fields.
sql

Jump to

Keyboard shortcuts

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