application

package
v2.4.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2017 License: MIT Imports: 6 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Application

type Application struct {
	AppID string `redis:"app_id"`
	// Decoder is a JavaScript function that accepts the payload as byte array and
	// returns an object containing the decoded values
	Decoder string `redis:"decoder"`
	// Converter is a JavaScript function that accepts the data as decoded by
	// Decoder and returns an object containing the converted values
	Converter string `redis:"converter"`
	// Validator is a JavaScript function that validates the data is converted by
	// Converter and returns a boolean value indicating the validity of the data
	Validator string `redis:"validator"`
	// Encoder is a JavaScript function that encode the data send on Downlink messages
	// Returns an object containing the converted values in []byte
	Encoder string `redis:"encoder"`

	CreatedAt time.Time `redis:"created_at"`
	UpdatedAt time.Time `redis:"updated_at"`
	// contains filtered or unexported fields
}

Application contains the state of an application

func (Application) ChangedFields

func (a Application) ChangedFields() (changed []string)

ChangedFields returns the names of the changed fields since the last call to StartUpdate

func (*Application) StartUpdate

func (a *Application) StartUpdate()

StartUpdate stores the state of the device

type RedisApplicationStore

type RedisApplicationStore struct {
	// contains filtered or unexported fields
}

RedisApplicationStore stores Applications in Redis. - Applications are stored as a Hash

func (*RedisApplicationStore) Delete

func (s *RedisApplicationStore) Delete(appID string) error

Delete an Application

func (*RedisApplicationStore) Get

func (s *RedisApplicationStore) Get(appID string) (*Application, error)

Get a specific Application

func (*RedisApplicationStore) List

List all Applications

func (*RedisApplicationStore) Set

func (s *RedisApplicationStore) Set(new *Application, properties ...string) (err error)

Set a new Application or update an existing one

type Store

type Store interface {
	List(opts *storage.ListOptions) ([]*Application, error)
	Get(appID string) (*Application, error)
	Set(new *Application, properties ...string) (err error)
	Delete(appID string) error
}

Store interface for Applications

func NewRedisApplicationStore

func NewRedisApplicationStore(client *redis.Client, prefix string) Store

NewRedisApplicationStore creates a new Redis-based Application store if an empty prefix is passed, a default prefix will be used.

Jump to

Keyboard shortcuts

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