store

package
v0.0.0-...-1606966 Latest Latest
Warning

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

Go to latest
Published: May 30, 2018 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CurrentKey    = "currentUser"
	LoginTokenKey = "currentLoginToken"
	StoreKey      = "store"
)

Keys for various values

Variables

This section is empty.

Functions

func ActivateUser

func ActivateUser(c context.Context, activationKey string, id string) error

func AddLoginToken

func AddLoginToken(c context.Context, user *models.User, ip string) (*models.LoginToken, error)

func CreateDevice

func CreateDevice(c context.Context, record *models.Device) error

Create a device in store

func CreateFleet

func CreateFleet(c context.Context, fleet *models.Fleet) error

func CreateLocation

func CreateLocation(c context.Context, location *models.Location) error

Create a single Location in store

func CreateSigfoxLocationWithMessage

func CreateSigfoxLocationWithMessage(c context.Context, location *models.Location, message *models.SigfoxMessage) error

Storing both Sigfox Message and Location

func CreateSigfoxMessage

func CreateSigfoxMessage(c context.Context, message *models.SigfoxMessage) error

Storing a Sigfox Message

func CreateUser

func CreateUser(c context.Context, record *models.User) error

func Current

func Current(c context.Context) *models.User

Get Current context

func DeleteDevice

func DeleteDevice(c context.Context, id string) error

Delete a specific device in store

func DeleteFleet

func DeleteFleet(c context.Context, id string) error

func FindUser

func FindUser(c context.Context, params params.M) (*models.User, error)

func FindUserById

func FindUserById(c context.Context, id string) (*models.User, error)

func GetAllDeviceLocations

func GetAllDeviceLocations(c context.Context, id string) ([]*models.Location, error)

Getting all locations from a specific device in store

func GetAllDeviceMessages

func GetAllDeviceMessages(c context.Context, id string) ([]*models.SigfoxMessage, error)

Getting all messages from a specific device in store

func GetAllFleets

func GetAllFleets(c context.Context) ([]models.Fleet, error)

func GetDevice

func GetDevice(c context.Context, id string) (*models.Device, error)

Getting details from a specific device in store

func GetDeviceLastMessage

func GetDeviceLastMessage(c context.Context, id string) (*models.SigfoxMessage, error)

Getting last message from a specific device in store

func GetDevices

func GetDevices(c context.Context) ([]*models.Device, error)

Get all devices of a User in store

func GetFleetById

func GetFleetById(c context.Context, id string) (*models.Fleet, error)

func GetLastDeviceLocations

func GetLastDeviceLocations(c context.Context, id string) ([]*models.Location, error)

Getting last locations from a specific device in store

func GetLastDeviceMessages

func GetLastDeviceMessages(c context.Context, id string) ([]*models.SigfoxMessage, error)

Getting last messages from a specific device in store

func GetLastDevicesLocations

func GetLastDevicesLocations(c context.Context) ([]*models.LastLocation, error)

Getting Last Locations from all devices of a user in store

func GetLastDevicesSigfoxMessages

func GetLastDevicesSigfoxMessages(c context.Context) ([]*models.SigfoxMessage, error)

Get Last Sigfox Messages from Devices

func GetLastFleetMessages

func GetLastFleetMessages(c context.Context, id string) ([]*models.SigfoxMessage, error)

func RemoveLoginToken

func RemoveLoginToken(c context.Context) error

func ToContext

func ToContext(c Setter, store Store)

Set a value in store

func UpdateDevice

func UpdateDevice(c context.Context, id string, m params.M) error

Update a specific device in store

func UpdateUser

func UpdateUser(c context.Context, params params.M) error

Types

type Setter

type Setter interface {
	Set(string, interface{})
}

Sets a value

type Store

type Store interface {
	CreateUser(*models.User) error
	FindUserById(string) (*models.User, error)
	ActivateUser(string, string) error
	FindUser(params.M) (*models.User, error)
	UpdateUser(*models.User, params.M) error

	CreateMessage(*models.SigfoxMessage) error
	CreateLocation(*models.Location) error
	CreateLocationWithMessage(*models.Location, *models.SigfoxMessage) error

	GetLastDevicesSigfoxMessages(*models.User) ([]*models.SigfoxMessage, error)

	CreateDevice(*models.Device, *models.User) error
	GetDevices(*models.User) ([]*models.Device, error)
	UpdateDevice(string, params.M) error
	DeleteDevice(string) error
	GetDevice(*models.User, string) (*models.Device, error)
	GetDeviceLastMessage(string) (*models.SigfoxMessage, error)
	GetLastDeviceMessages(string) ([]*models.SigfoxMessage, error)
	GetLastDeviceLocations(string) ([]*models.Location, error)
	GetAllDeviceMessages(string) ([]*models.SigfoxMessage, error)
	GetAllDeviceLocations(string) ([]*models.Location, error)

	GetLastDevicesLocations(*models.User) ([]*models.LastLocation, error)

	GetAllFleets() ([]models.Fleet, error)
	CreateFleet(*models.Fleet) error
	GetFleetById(string) (*models.Fleet, error)
	GetLastFleetMessages(id string) ([]*models.SigfoxMessage, error)
	DeleteFleet(id string) error

	AddLoginToken(*models.User, string) (*models.LoginToken, error)
	RemoveLoginToken(*models.User, string) error
}

func FromContext

func FromContext(c context.Context) Store

Get value from Store

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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