application

package
v2.6.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2017 License: MIT Imports: 7 Imported by: 0

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) DBVersion

func (a *Application) DBVersion() string

DBVersion of the model

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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