application

package
v2.8.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 5, 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"`
	// PayloadFormat indicates how payload is binary formatted
	PayloadFormat PayloadFormat `redis:"payload_format"`
	// CustomDecoder is a JavaScript function that accepts the payload as byte array and
	// returns an object containing the decoded values when the PayloadFormat is set to
	// PayloadFormatCustom
	CustomDecoder string `redis:"custom_decoder"`
	// CustomConverter is a JavaScript function that accepts the data as decoded by
	// Decoder and returns an object containing the converted values when the PayloadFormat
	// is set to PayloadFormatCustom
	CustomConverter string `redis:"custom_converter"`
	// CustomValidator is a JavaScript function that validates the data is converted by
	// Converter and returns a boolean value indicating the validity of the data when the
	// PayloadFormat is set to PayloadFormatCustom
	CustomValidator string `redis:"custom_validator"`
	// CustomEncoder is a JavaScript function that encode the data send on Downlink messages
	// Returns an object containing the converted values in []byte when the PayloadFormat is
	// set to PayloadFormatCustom
	CustomEncoder string `redis:"custom_encoder"`

	RegisterOnJoinAccessKey string `redis:"register_on_join_access_key"`

	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 PayloadFormat

type PayloadFormat string

PayloadFormat indicates how payload is binary formatted

const (
	// PayloadFormatCustom indicates that the payload has a custom binary format
	PayloadFormatCustom PayloadFormat = "custom"
	// PayloadFormatCayenneLPP indicates that the payload is formatted as CayenneLPP
	PayloadFormatCayenneLPP PayloadFormat = "cayennelpp"
)

type RedisApplicationStore

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

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

func (*RedisApplicationStore) Count

func (s *RedisApplicationStore) Count() (int, error)

Count all applications in the store

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 {
	Count() (int, error)
	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