adaptors

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionRepo

type ActionRepo interface {
	Add(ctx context.Context, ver *m.Action) (id int64, err error)
	GetById(ctx context.Context, id int64) (metric *m.Action, err error)
	Update(ctx context.Context, ver *m.Action) error
	Delete(ctx context.Context, deviceId int64) (err error)
	List(ctx context.Context, limit, offset int64, orderBy, sort string, ids *[]uint64) (list []*m.Action, total int64, err error)
	Search(ctx context.Context, query string, limit, offset int) (list []*m.Action, total int64, err error)
}

ActionRepo ...

type Adaptors

type Adaptors struct {
	Script            ScriptRepo
	Tag               TagRepo
	Role              RoleRepo
	Permission        PermissionRepo
	User              UserRepo
	UserMeta          UserMetaRepo
	UserDevice        UserDeviceRepo
	Image             ImageRepo
	Variable          VariableRepo
	Entity            EntityRepo
	EntityState       EntityStateRepo
	EntityAction      EntityActionRepo
	EntityStorage     EntityStorageRepo
	Log               LogRepo
	Template          TemplateRepo
	Message           MessageRepo
	MessageDelivery   MessageDeliveryRepo
	Zigbee2mqtt       Zigbee2mqttRepo
	Zigbee2mqttDevice Zigbee2mqttDeviceRepo
	AlexaSkill        AlexaSkillRepo
	AlexaIntent       AlexaIntentRepo
	Metric            MetricRepo
	MetricBucket      MetricBucketRepo
	Area              AreaRepo
	Action            ActionRepo
	Condition         ConditionRepo
	Trigger           TriggerRepo
	Task              TaskRepo
	RunHistory        RunHistoryRepo
	Plugin            PluginRepo
	TelegramChat      TelegramChatRepo
	Dashboard         DashboardRepo
	DashboardTab      DashboardTabRepo
	DashboardCard     IDashboardCard
	DashboardCardItem DashboardCardItemRepo
	ScriptVersion     ScriptVersionRepo
	Automation        AutomationRepo
	Transaction       TransactionManger
}

type AlexaIntentRepo

type AlexaIntentRepo interface {
	Add(ctx context.Context, ver *m.AlexaIntent) (err error)
	GetByName(ctx context.Context, name string) (ver *m.AlexaIntent, err error)
	Update(ctx context.Context, ver *m.AlexaIntent) (err error)
	Delete(ctx context.Context, ver *m.AlexaIntent) (err error)
}

AlexaIntentRepo ...

type AlexaSkillRepo

type AlexaSkillRepo interface {
	Add(ctx context.Context, app *m.AlexaSkill) (id int64, err error)
	GetById(ctx context.Context, appId int64) (app *m.AlexaSkill, err error)
	Update(ctx context.Context, params *m.AlexaSkill) (err error)
	Delete(ctx context.Context, appId int64) (err error)
	List(ctx context.Context, limit, offset int64, orderBy, sort string) (list []*m.AlexaSkill, total int64, err error)
	ListEnabled(ctx context.Context, limit, offset int64) (list []*m.AlexaSkill, err error)
}

AlexaSkillRepo ...

type AreaRepo

type AreaRepo interface {
	Add(ctx context.Context, ver *m.Area) (id int64, err error)
	GetById(ctx context.Context, verId int64) (ver *m.Area, err error)
	GetByName(ctx context.Context, name string) (ver *m.Area, err error)
	Update(ctx context.Context, ver *m.Area) (err error)
	DeleteByName(ctx context.Context, name string) (err error)
	List(ctx context.Context, limit, offset int64, orderBy, sort string) (list []*m.Area, total int64, err error)
	Search(ctx context.Context, query string, limit, offset int64) (list []*m.Area, total int64, err error)
}

AreaRepo ...

type AutomationRepo

type AutomationRepo interface {
	Statistic(ctx context.Context) (statistic *m.AutomationStatistic, err error)
}

AutomationRepo ...

type ConditionRepo

type ConditionRepo interface {
	Add(ctx context.Context, ver *m.Condition) (id int64, err error)
	GetById(ctx context.Context, id int64) (metric *m.Condition, err error)
	Update(ctx context.Context, ver *m.Condition) error
	Delete(ctx context.Context, deviceId int64) (err error)
	List(ctx context.Context, limit, offset int64, orderBy, sort string, ids *[]uint64) (list []*m.Condition, total int64, err error)
	Search(ctx context.Context, query string, limit, offset int) (list []*m.Condition, total int64, err error)
}

ConditionRepo ...

type DashboardCardItemRepo

type DashboardCardItemRepo interface {
	Add(ctx context.Context, ver *m.DashboardCardItem) (id int64, err error)
	GetById(ctx context.Context, mapId int64) (ver *m.DashboardCardItem, err error)
	Update(ctx context.Context, ver *m.DashboardCardItem) (err error)
	Delete(ctx context.Context, id int64) (err error)
	List(ctx context.Context, limit, offset int64, orderBy, sort string) (list []*m.DashboardCardItem, total int64, err error)
}

type DashboardRepo

type DashboardRepo interface {
	Add(ctx context.Context, ver *m.Dashboard) (id int64, err error)
	GetById(ctx context.Context, mapId int64) (ver *m.Dashboard, err error)
	Update(ctx context.Context, ver *m.Dashboard) (err error)
	Delete(ctx context.Context, id int64) (err error)
	List(ctx context.Context, limit, offset int64, orderBy, sort string) (list []*m.Dashboard, total int64, err error)
	Search(ctx context.Context, query string, limit, offset int64) (list []*m.Dashboard, total int64, err error)
}

type DashboardTabRepo

type DashboardTabRepo interface {
	Add(ctx context.Context, ver *m.DashboardTab) (id int64, err error)
	GetById(ctx context.Context, mapId int64) (ver *m.DashboardTab, err error)
	Update(ctx context.Context, ver *m.DashboardTab) (err error)
	Delete(ctx context.Context, id int64) (err error)
	List(ctx context.Context, limit, offset int64, orderBy, sort string) (list []*m.DashboardTab, total int64, err error)
}

type EntityActionRepo

type EntityActionRepo interface {
	Add(ctx context.Context, ver *m.EntityAction) (id int64, err error)
	DeleteByEntityId(ctx context.Context, id common.EntityId) (err error)
	AddMultiple(ctx context.Context, items []*m.EntityAction) (err error)
}

EntityActionRepo ...

type EntityRepo

type EntityRepo interface {
	Add(ctx context.Context, ver *m.Entity) (err error)
	GetById(ctx context.Context, id common.EntityId, preloadMetric ...bool) (ver *m.Entity, err error)
	GetByIds(ctx context.Context, ids []common.EntityId, preloadMetric ...bool) (ver []*m.Entity, err error)
	GetByIdsSimple(ctx context.Context, ids []common.EntityId) (list []*m.Entity, err error)
	Delete(ctx context.Context, id common.EntityId) (err error)
	List(ctx context.Context, limit, offset int64, orderBy, sort string, autoLoad bool, query, plugin *string,
		areaId *int64) (list []*m.Entity, total int64, err error)
	ListPlain(ctx context.Context, limit, offset int64, orderBy, sort string, autoLoad bool, query, plugin *string,
		areaId *int64, tags *[]string) (list []*m.Entity, total int64, err error)
	GetByType(ctx context.Context, t string, limit, offset int64) (list []*m.Entity, err error)
	Update(ctx context.Context, ver *m.Entity) (err error)
	Search(ctx context.Context, query string, limit, offset int64) (list []*m.Entity, total int64, err error)
	UpdateAutoload(ctx context.Context, entityId common.EntityId, autoLoad bool) (err error)
	Statistic(ctx context.Context) (statistic *m.EntitiesStatistic, err error)
	DeleteScripts(ctx context.Context, entityID common.EntityId) (err error)
	DeleteTags(ctx context.Context, entityID common.EntityId) (err error)
}

EntityRepo ...

type EntityStateRepo

type EntityStateRepo interface {
	Add(ctx context.Context, ver *m.EntityState) (id int64, err error)
	DeleteByEntityId(ctx context.Context, entityId common.EntityId) (err error)
	AddMultiple(ctx context.Context, items []*m.EntityState) (err error)
}

EntityStateRepo ...

type EntityStorageRepo

type EntityStorageRepo interface {
	Add(ctx context.Context, ver *m.EntityStorage) (id int64, err error)
	GetLastByEntityId(ctx context.Context, entityId common.EntityId) (ver *m.EntityStorage, err error)
	List(ctx context.Context, limit, offset int64, orderBy, sort string,
		entityIds []common.EntityId,
		startDate, endDate *time.Time) (list []*m.EntityStorage, total int64, err error)
	GetLastThreeById(ctx context.Context, entityId common.EntityId, id int64) (list []*m.EntityStorage, err error)
	DeleteOldest(ctx context.Context, days int) (err error)
}

EntityStorageRepo ...

type IDashboardCard

type IDashboardCard interface {
	Add(ctx context.Context, ver *m.DashboardCard) (id int64, err error)
	GetById(ctx context.Context, mapId int64) (ver *m.DashboardCard, err error)
	Update(ctx context.Context, ver *m.DashboardCard) (err error)
	Delete(ctx context.Context, id int64) (err error)
	List(ctx context.Context, limit, offset int64, orderBy, sort string) (list []*m.DashboardCard, total int64, err error)
}

type ImageRepo

type ImageRepo interface {
	Add(ctx context.Context, ver *m.Image) (id int64, err error)
	GetByImageName(ctx context.Context, imageName string) (ver *m.Image, err error)
	GetById(ctx context.Context, mapId int64) (ver *m.Image, err error)
	Update(ctx context.Context, ver *m.Image) (err error)
	Delete(ctx context.Context, mapId int64) (err error)
	List(ctx context.Context, limit, offset int64, orderBy, sort string) (list []*m.Image, total int64, err error)
	AddMultiple(ctx context.Context, items []*m.Image) (err error)
	GetAllByDate(ctx context.Context, filter string) (images []*m.Image, err error)
	GetFilterList(ctx context.Context) (filterList []*m.ImageFilterList, err error)
}

ImageRepo ...

type LogRepo

type LogRepo interface {
	Add(ctx context.Context, ver *m.Log) (id int64, err error)
	AddMultiple(ctx context.Context, items []*m.Log) (err error)
	GetById(ctx context.Context, verId int64) (ver *m.Log, err error)
	Delete(ctx context.Context, verId int64) (err error)
	List(ctx context.Context, limit, offset int64, orderBy, sort string, queryObj *m.LogQuery) (list []*m.Log, total int64, err error)
	Search(ctx context.Context, query string, limit, offset int) (list []*m.Log, total int64, err error)
	DeleteOldest(ctx context.Context, days int) (err error)
}

LogRepo ...

type MessageDeliveryRepo

type MessageDeliveryRepo interface {
	Add(ctx context.Context, msg *m.MessageDelivery) (id int64, err error)
	SetStatus(ctx context.Context, msg *m.MessageDelivery) (err error)
	List(ctx context.Context, limit, offset int64, orderBy, sort string, query *m.MessageDeliveryQuery) (list []*m.MessageDelivery, total int64, err error)
	GetAllUncompleted(ctx context.Context, limit, offset int64) (list []*m.MessageDelivery, total int64, err error)
	Delete(ctx context.Context, id int64) (err error)
	GetById(ctx context.Context, id int64) (ver *m.MessageDelivery, err error)
}

MessageDeliveryRepo ...

type MessageRepo

type MessageRepo interface {
	Add(ctx context.Context, msg *m.Message) (id int64, err error)
}

MessageRepo ...

type MetricBucketRepo

type MetricBucketRepo interface {
	Add(ctx context.Context, ver *m.MetricDataItem) error
	AddMultiple(ctx context.Context, items []*m.MetricDataItem) (err error)
	List(ctx context.Context, from, to *time.Time, metricId int64, optionItems []string, metricRange *common.MetricRange) (list []*m.MetricDataItem, err error)
	DeleteOldest(ctx context.Context, days int) (err error)
	DeleteById(ctx context.Context, id int64) (err error)
	DeleteByMetricId(ctx context.Context, metricId int64) (err error)
}

MetricBucketRepo ...

type MetricRepo

type MetricRepo interface {
	Add(ctx context.Context, ver *m.Metric) (id int64, err error)
	GetByIdWithData(ctx context.Context, id int64, from, to *time.Time, metricRange *common.MetricRange) (metric *m.Metric, err error)
	Update(ctx context.Context, ver *m.Metric) error
	Delete(ctx context.Context, deviceId int64) (err error)
	AddMultiple(ctx context.Context, items []*m.Metric) (err error)
	List(ctx context.Context, limit, offset int64, orderBy, sort string) (list []*m.Metric, total int64, err error)
	Search(ctx context.Context, query string, limit, offset int) (list []*m.Metric, total int64, err error)
}

MetricRepo ...

type PermissionRepo

type PermissionRepo interface {
	Add(ctx context.Context, permission *m.Permission) (id int64, err error)
	Delete(ctx context.Context, roleName, packageName string, levelName []string) (err error)
	GetAllPermissions(ctx context.Context, roleName string) (permissions []*m.Permission, err error)
}

PermissionRepo ...

type PluginRepo

type PluginRepo interface {
	Add(ctx context.Context, plugin *m.Plugin) error
	CreateOrUpdate(ctx context.Context, ver *m.Plugin) error
	Update(ctx context.Context, plugin *m.Plugin) error
	Delete(ctx context.Context, pluginId string) error
	List(ctx context.Context, limit, offset int64, orderBy, sort string, enabled, triggers *bool) (list []*m.Plugin, total int64, err error)
	Search(ctx context.Context, query string, limit, offset int64) (list []*m.Plugin, total int64, err error)
	GetByName(ctx context.Context, name string) (ver *m.Plugin, err error)
}

PluginRepo ...

type RoleRepo

type RoleRepo interface {
	Add(ctx context.Context, role *m.Role) (err error)
	GetByName(ctx context.Context, name string) (role *m.Role, err error)
	Update(ctx context.Context, role *m.Role) (err error)
	Delete(ctx context.Context, name string) (err error)
	List(ctx context.Context, limit, offset int64, orderBy, sort string) (list []*m.Role, total int64, err error)
	Search(ctx context.Context, query string, limit, offset int64) (list []*m.Role, total int64, err error)
	GetAccessList(ctx context.Context, role *m.Role) (err error)
}

RoleRepo ...

type RunHistoryRepo

type RunHistoryRepo interface {
	Add(sctx context.Context, tory *m.RunStory) (id int64, err error)
	Update(ctx context.Context, story *m.RunStory) (err error)
	List(ctx context.Context, limit, offset int64, orderBy, sort string, from *time.Time) (list []*m.RunStory, total int64, err error)
	DeleteOldest(ctx context.Context, days int) (err error)
}

RunHistoryRepo ...

type ScriptRepo

type ScriptRepo interface {
	Add(ctx context.Context, script *m.Script) (id int64, err error)
	GetById(ctx context.Context, scriptId int64) (script *m.Script, err error)
	GetByName(ctx context.Context, name string) (script *m.Script, err error)
	Update(ctx context.Context, script *m.Script) (err error)
	Delete(ctx context.Context, scriptId int64) (err error)
	List(ctx context.Context, limit, offset int64, orderBy, sort string, query *string, ids *[]uint64) (list []*m.Script, total int64, err error)
	Search(ctx context.Context, query string, limit, offset int64) (list []*m.Script, total int64, err error)
	Statistic(ctx context.Context) (statistic *m.ScriptsStatistic, err error)
}

ScriptRepo ...

type ScriptVersionRepo

type ScriptVersionRepo interface {
	Delete(ctx context.Context, id int64) (err error)
}

ScriptVersionRepo ...

type TagRepo

type TagRepo interface {
	Add(ctx context.Context, tag *m.Tag) (id int64, err error)
	GetById(ctx context.Context, id int64) (tag *m.Tag, err error)
	GetByName(ctx context.Context, name string) (tag *m.Tag, err error)
	Update(ctx context.Context, tag *m.Tag) (err error)
	List(ctx context.Context, limit, offset int64, orderBy, sort string, query *string, names *[]string) (list []*m.Tag, total int64, err error)
	Delete(ctx context.Context, name string) (err error)
	Search(ctx context.Context, query string, limit, offset int64) (list []*m.Tag, total int64, err error)
}

TagRepo ...

type TaskRepo

type TaskRepo interface {
	Add(ctx context.Context, ver *m.NewTask) (id int64, err error)
	Import(ctx context.Context, ver *m.Task) (err error)
	Update(ctx context.Context, ver *m.Task) (err error)
	Delete(ctx context.Context, id int64) (err error)
	GetById(ctx context.Context, id int64) (task *m.Task, err error)
	List(ctx context.Context, limit, offset int64, orderBy, sort string, onlyEnabled bool) (list []*m.Task, total int64, err error)
	Enable(ctx context.Context, id int64) (err error)
	Disable(ctx context.Context, id int64) (err error)
	DeleteTrigger(ctx context.Context, taskID int64) error
	DeleteCondition(ctx context.Context, taskID int64) error
	DeleteAction(ctx context.Context, taskID int64) error
}

TaskRepo ...

type TelegramChatRepo

type TelegramChatRepo interface {
	Add(ctx context.Context, plugin m.TelegramChat) (err error)
	Delete(ctx context.Context, entityId common.EntityId, channelId int64) (err error)
	List(ctx context.Context, limit, offset int64, orderBy, sort string, entityId common.EntityId) (list []m.TelegramChat, total int64, err error)
}

TelegramChatRepo ...

type TemplateRepo

type TemplateRepo interface {
	UpdateOrCreate(ctx context.Context, ver *models.Template) (err error)
	Create(ctx context.Context, ver *models.Template) (err error)
	UpdateStatus(ctx context.Context, ver *models.Template) (err error)
	GetList(ctx context.Context, templateType models.TemplateType) (items []*models.Template, err error)
	GetByName(ctx context.Context, name string) (ver *models.Template, err error)
	GetItemByName(ctx context.Context, name string) (ver *models.Template, err error)
	GetItemsSortedList(ctx context.Context) (count int64, items []string, err error)
	Delete(ctx context.Context, name string) (err error)
	GetItemsTree(ctx context.Context) (tree []*models.TemplateTree, err error)
	UpdateItemsTree(ctx context.Context, tree []*models.TemplateTree) (err error)
	Search(ctx context.Context, query string, limit, offset int) (list []*models.Template, total int64, err error)
	GetMarkers(ctx context.Context, template *models.Template) (err error)
	Render(ctx context.Context, name string, params map[string]interface{}) (render *models.TemplateRender, err error)
}

TemplateRepo ...

type TransactionManger

type TransactionManger interface {
	Do(context.Context, func(context.Context) error) error
}

type TriggerRepo

type TriggerRepo interface {
	Add(ctx context.Context, ver *m.NewTrigger) (id int64, err error)
	GetById(ctx context.Context, id int64) (metric *m.Trigger, err error)
	DeleteEntity(ctx context.Context, triggerID int64) (err error)
	Update(ctx context.Context, ver *m.UpdateTrigger) error
	Delete(ctx context.Context, deviceId int64) (err error)
	List(ctx context.Context, limit, offset int64, orderBy, sort string, onlyEnabled bool) (list []*m.Trigger, total int64, err error)
	ListPlain(ctx context.Context, limit, offset int64, orderBy, sort string, onlyEnabled bool, ids *[]uint64) (list []*m.Trigger, total int64, err error)
	Search(ctx context.Context, query string, limit, offset int) (list []*m.Trigger, total int64, err error)
	Enable(ctx context.Context, id int64) (err error)
	Disable(ctx context.Context, id int64) (err error)
}

TriggerRepo ...

type UserDeviceRepo

type UserDeviceRepo interface {
	Add(ctx context.Context, ver *m.UserDevice) (id int64, err error)
	GetByUserId(ctx context.Context, userId int64) (list []*m.UserDevice, err error)
	List(ctx context.Context, limit, offset int64, orderBy, sort string) (list []*m.UserDevice, total int64, err error)
	Delete(ctx context.Context, id int64) (err error)
}

UserDeviceRepo ...

type UserMetaRepo

type UserMetaRepo interface {
	UpdateOrCreate(ctx context.Context, meta *m.UserMeta) (id int64, err error)
}

UserMetaRepo ...

type UserRepo

type UserRepo interface {
	Add(ctx context.Context, user *m.User) (id int64, err error)
	GetById(ctx context.Context, userId int64) (user *m.User, err error)
	GetByNickname(ctx context.Context, nick string) (user *m.User, err error)
	GetByEmail(ctx context.Context, email string) (user *m.User, err error)
	GetByAuthenticationToken(ctx context.Context, token string) (user *m.User, err error)
	GetByResetPassToken(ctx context.Context, token string) (user *m.User, err error)
	Update(ctx context.Context, user *m.User) (err error)
	Delete(ctx context.Context, userId int64) (err error)
	List(ctx context.Context, limit, offset int64, orderBy, sort string) (list []*m.User, total int64, err error)
	SignIn(ctx context.Context, u *m.User, ipv4 string) (err error)
	GenResetPassToken(ctx context.Context, u *m.User) (token string, err error)
	ClearResetPassToken(ctx context.Context, u *m.User) (err error)
	ClearToken(ctx context.Context, u *m.User) (err error)
}

UserRepo ...

type VariableRepo

type VariableRepo interface {
	CreateOrUpdate(ctx context.Context, ver m.Variable) (err error)
	GetByName(ctx context.Context, name string) (ver m.Variable, err error)
	Delete(ctx context.Context, name string) (err error)
	DeleteTags(ctx context.Context, name string) (err error)
	List(ctx context.Context, limit, offset int64, orderBy, sort string, system bool, name string) (list []m.Variable, total int64, err error)
	Search(ctx context.Context, query string, limit, offset int) (list []m.Variable, total int64, err error)
}

VariableRepo ...

type Zigbee2mqttDeviceRepo

type Zigbee2mqttDeviceRepo interface {
	Add(ctx context.Context, ver *m.Zigbee2mqttDevice) (err error)
	GetById(ctx context.Context, id string) (ver *m.Zigbee2mqttDevice, err error)
	Update(ctx context.Context, ver *m.Zigbee2mqttDevice) (err error)
	Delete(ctx context.Context, id string) (err error)
	List(ctx context.Context, limit, offset int64) (list []*m.Zigbee2mqttDevice, total int64, err error)
	ListByBridgeId(ctx context.Context, bridgeId, limit, offset int64, orderBy, sort string) (list []*m.Zigbee2mqttDevice, total int64, err error)
	Search(ctx context.Context, query string, limit, offset int64) (list []*m.Zigbee2mqttDevice, total int64, err error)
}

Zigbee2mqttDeviceRepo ...

type Zigbee2mqttRepo

type Zigbee2mqttRepo interface {
	Add(ctx context.Context, ver *m.Zigbee2mqtt) (id int64, err error)
	GetById(ctx context.Context, id int64) (ver *m.Zigbee2mqtt, err error)
	Update(ctx context.Context, ver *m.Zigbee2mqtt) (err error)
	Delete(ctx context.Context, id int64) (err error)
	List(ctx context.Context, limit, offset int64) (list []*m.Zigbee2mqtt, total int64, err error)
	GetByLogin(ctx context.Context, login string) (ver *m.Zigbee2mqtt, err error)
}

Zigbee2mqttRepo ...

Jump to

Keyboard shortcuts

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