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 ¶
func (s *RedisApplicationStore) List() ([]*Application, error)
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() ([]*Application, error) Get(appID string) (*Application, error) Set(new *Application, properties ...string) (err error) Delete(appID string) error }
Store interface for Applications
func NewRedisApplicationStore ¶
NewRedisApplicationStore creates a new Redis-based Application store if an empty prefix is passed, a default prefix will be used.
Click to show internal directories.
Click to hide internal directories.