Versions in this module Expand all Collapse all v0 v0.0.1 Oct 16, 2020 Changes in this version + var ErrConflict = errors.New("entity already exists") + var ErrConnect = errors.New("add connection failed") + var ErrCreateEntity = errors.New("create entity failed") + var ErrCreateUUID = errors.New("uuid creation failed") + var ErrDisconnect = errors.New("remove connection failed") + var ErrEntityConnected = errors.New("check thing-channel connection in database error") + var ErrMalformedEntity = errors.New("malformed entity specification") + var ErrNotFound = errors.New("non-existent entity") + var ErrRemoveEntity = errors.New("remove entity failed") + var ErrScanMetadata = errors.New("failed to scan metadata in db") + var ErrSelectEntity = errors.New("select entity from db error") + var ErrUnauthorizedAccess = errors.New("missing or invalid credentials provided") + var ErrUpdateEntity = errors.New("update entity failed") + var ErrViewEntity = errors.New("view entity failed") + type Channel struct + ID string + Metadata map[string]interface{} + Name string + Owner string + type ChannelCache interface + Connect func(context.Context, string, string) error + Disconnect func(context.Context, string, string) error + HasThing func(context.Context, string, string) bool + Remove func(context.Context, string) error + type ChannelRepository interface + Connect func(ctx context.Context, owner string, chIDs, thIDs []string) error + Disconnect func(ctx context.Context, owner, chanID, thingID string) error + HasThing func(ctx context.Context, chanID, key string) (string, error) + HasThingByID func(ctx context.Context, chanID, thingID string) error + Remove func(ctx context.Context, owner, id string) error + RetrieveAll func(ctx context.Context, owner string, offset, limit uint64, name string, ...) (ChannelsPage, error) + RetrieveByID func(ctx context.Context, owner, id string) (Channel, error) + RetrieveByThing func(ctx context.Context, owner, thing string, offset, limit uint64, connected bool) (ChannelsPage, error) + Save func(ctx context.Context, chs ...Channel) ([]Channel, error) + Update func(ctx context.Context, c Channel) error + type ChannelsPage struct + Channels []Channel + type Metadata map[string]interface + type Page struct + Things []Thing + type PageMetadata struct + Limit uint64 + Name string + Offset uint64 + Total uint64 + type Service interface + CanAccessByID func(ctx context.Context, chanID, thingID string) error + CanAccessByKey func(ctx context.Context, chanID, key string) (string, error) + Connect func(ctx context.Context, token string, chIDs, thIDs []string) error + CreateChannels func(ctx context.Context, token string, channels ...Channel) ([]Channel, error) + CreateThings func(ctx context.Context, token string, things ...Thing) ([]Thing, error) + Disconnect func(ctx context.Context, token, chanID, thingID string) error + Identify func(ctx context.Context, key string) (string, error) + ListChannels func(ctx context.Context, token string, offset, limit uint64, name string, ...) (ChannelsPage, error) + ListChannelsByThing func(ctx context.Context, token, thing string, offset, limit uint64, connected bool) (ChannelsPage, error) + ListThings func(ctx context.Context, token string, offset, limit uint64, name string, ...) (Page, error) + ListThingsByChannel func(ctx context.Context, token, channel string, offset, limit uint64, ...) (Page, error) + RemoveChannel func(ctx context.Context, token, id string) error + RemoveThing func(ctx context.Context, token, id string) error + UpdateChannel func(ctx context.Context, token string, channel Channel) error + UpdateKey func(ctx context.Context, token, id, key string) error + UpdateThing func(ctx context.Context, token string, thing Thing) error + ViewChannel func(ctx context.Context, token, id string) (Channel, error) + ViewThing func(ctx context.Context, token, id string) (Thing, error) + func New(auth mainflux.AuthNServiceClient, things ThingRepository, ...) Service + type Thing struct + ID string + Key string + Metadata Metadata + Name string + Owner string + type ThingCache interface + ID func(context.Context, string) (string, error) + Remove func(context.Context, string) error + Save func(context.Context, string, string) error + type ThingRepository interface + Remove func(ctx context.Context, owner, id string) error + RetrieveAll func(ctx context.Context, owner string, offset, limit uint64, name string, ...) (Page, error) + RetrieveByChannel func(ctx context.Context, owner, channel string, offset, limit uint64, ...) (Page, error) + RetrieveByID func(ctx context.Context, owner, id string) (Thing, error) + RetrieveByKey func(ctx context.Context, key string) (string, error) + Save func(ctx context.Context, ths ...Thing) ([]Thing, error) + Update func(ctx context.Context, t Thing) error + UpdateKey func(ctx context.Context, owner, id, key string) error