mongo

package
v0.0.0-...-e4c96ca Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2017 License: Apache-2.0, Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DbVersion = "0.1.0"

	DbName        = "inventory"
	DbDevicesColl = "devices"

	DbDevAttributes      = "attributes"
	DbDevGroup           = "group"
	DbDevAttributesDesc  = "description"
	DbDevAttributesValue = "value"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DataStoreMongo

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

func NewDataStoreMongo

func NewDataStoreMongo(host string) (*DataStoreMongo, error)

func NewDataStoreMongoWithSession

func NewDataStoreMongoWithSession(session *mgo.Session) *DataStoreMongo

func (*DataStoreMongo) AddDevice

func (db *DataStoreMongo) AddDevice(ctx context.Context, dev *model.Device) error

func (*DataStoreMongo) DeleteDevice

func (db *DataStoreMongo) DeleteDevice(ctx context.Context, id model.DeviceID) error

func (*DataStoreMongo) GetDevice

func (db *DataStoreMongo) GetDevice(ctx context.Context, id model.DeviceID) (*model.Device, error)

func (*DataStoreMongo) GetDeviceGroup

func (db *DataStoreMongo) GetDeviceGroup(ctx context.Context, id model.DeviceID) (model.GroupName, error)

func (*DataStoreMongo) GetDevices

func (db *DataStoreMongo) GetDevices(ctx context.Context, skip int, limit int, filters []store.Filter, sort *store.Sort, hasGroup *bool) ([]model.Device, error)

func (*DataStoreMongo) GetDevicesByGroup

func (db *DataStoreMongo) GetDevicesByGroup(ctx context.Context, group model.GroupName, skip, limit int) ([]model.DeviceID, error)

func (*DataStoreMongo) ListGroups

func (db *DataStoreMongo) ListGroups(ctx context.Context) ([]model.GroupName, error)

func (*DataStoreMongo) Migrate

func (db *DataStoreMongo) Migrate(ctx context.Context, version string, migrations []migrate.Migration) error

func (*DataStoreMongo) UnsetDeviceGroup

func (db *DataStoreMongo) UnsetDeviceGroup(ctx context.Context, id model.DeviceID, groupName model.GroupName) error

func (*DataStoreMongo) UpdateDeviceGroup

func (db *DataStoreMongo) UpdateDeviceGroup(ctx context.Context, devId model.DeviceID, newGroup model.GroupName) error

func (*DataStoreMongo) UpsertAttributes

func (db *DataStoreMongo) UpsertAttributes(ctx context.Context, id model.DeviceID, attrs model.DeviceAttributes) error

Jump to

Keyboard shortcuts

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