db

package
v0.0.0-...-ef9407b Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2017 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitializeRegistry

func InitializeRegistry(c core.Config) error

InitializeRegistry try to connect with background database to confirm wether it is normal

Types

type Device

type Device struct {
	Id           string
	Name         string
	ProductId    string
	ProductKey   string
	DeviceStatus string
	DeviceSecret string
	TimeCreated  time.Time
	TimeModified time.Time
}

Device

type Product

type Product struct {
	Id           string
	Name         string
	Description  string
	TimeCreated  time.Time
	TimeModified time.Time
	CategoryId   string
}

Product

type Registry

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

Registry is wraper of mongo database about for iot object

func NewRegistry

func NewRegistry(c core.Config) (*Registry, error)

NewRegistry create registry instance

func (*Registry) BulkDeleteDevice

func (r *Registry) BulkDeleteDevice(devices []string) error

BulkDeleteDevice delete a lot of devices from registry

func (*Registry) BulkRegisterDevice

func (r *Registry) BulkRegisterDevice(devices []Device) error

BulkRegisterDevice add a lot of devices into registry

func (*Registry) BulkUpdateDevice

func (r *Registry) BulkUpdateDevice(devices []Device) error

BulkUpdateDevice update a lot of devices in registry

func (*Registry) CheckProductNameAvailable

func (r *Registry) CheckProductNameAvailable(p *Product) bool

Product CheckProductNameAvailable check wethere product name is available

func (*Registry) CheckTenantNameAvailable

func (r *Registry) CheckTenantNameAvailable(t *Tenant) bool

CheckTenantNamveAvailable return true if name is available

func (*Registry) DeleteDevice

func (r *Registry) DeleteDevice(id string) error

DeleteDevice delete a device from registry

func (*Registry) DeleteProduct

func (r *Registry) DeleteProduct(id string) error

DeleteProduct delete a product from registry

func (*Registry) DeleteRule

func (r *Registry) DeleteRule(id string) error

DeleteRule delete a rule from registry

func (*Registry) DeleteTenant

func (r *Registry) DeleteTenant(t *Tenant) error

func (*Registry) GetDevice

func (r *Registry) GetDevice(id string) (*Device, error)

GetDevice retrieve a device information from registry/

func (*Registry) GetProduct

func (r *Registry) GetProduct(id string) (*Product, error)

GetProduct retrieve product detail information from registry

func (*Registry) GetProductDevices

func (r *Registry) GetProductDevices(id string) ([]Device, error)

GetProductDevices get product's device list

func (*Registry) GetRule

func (r *Registry) GetRule(id string) (*Rule, error)

GetRule retrieve a rule information from registry/

func (*Registry) GetTenant

func (r *Registry) GetTenant(t *Tenant) error

func (*Registry) RegisterDevice

func (r *Registry) RegisterDevice(dev *Device) error

RegisterDevice add a new device into registry

func (*Registry) RegisterProduct

func (r *Registry) RegisterProduct(p *Product) error

RegisterProduct register a product into registry

func (*Registry) RegisterRule

func (r *Registry) RegisterRule(rule *Rule) error

RegisterRule add a new rule into registry

func (*Registry) RegisterTenant

func (r *Registry) RegisterTenant(t *Tenant) error

AddTenant insert a tenant into registry

func (*Registry) Release

func (r *Registry) Release()

Release release registry rources and disconnect with background database

func (*Registry) UpdateDevice

func (r *Registry) UpdateDevice(dev *Device) error

UpdateDevice update device information in registry

func (*Registry) UpdateProduct

func (r *Registry) UpdateProduct(p *Product) error

UpdateProduct update product detail information in registry

func (*Registry) UpdateRule

func (r *Registry) UpdateRule(rule *Rule) error

UpdateRule update rule information in registry

type Rule

type Rule struct {
	Id           string
	Name         string
	ProductId    string
	TimeCreated  time.Time
	TimeModified time.Time
	Status       string
	Method       string
	Target       string
}

Rule

type Tenant

type Tenant struct {
	Id   string
	Name string
}

Tenant

Jump to

Keyboard shortcuts

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