Documentation ¶
Overview ¶
Package repositories implements repositories for use in services.
Index ¶
- func NewDatabaseConnection(dsn string) (*gorm.DB, error)
- func NewDatabaseConnectionAndMigrate(ctx context.Context, dsn string) (db *gorm.DB, err error)
- func StringToCategory(category string) datasourcetype.Category
- func StringToType(category string) upload.InstanceType
- type APIKeyModel
- type APIKeyRepository
- type AccountModel
- type AccountRepository
- func (r *AccountRepository) Create(account account.Account) (account.Account, error)
- func (r *AccountRepository) Delete(account account.Account) error
- func (r *AccountRepository) Find(accountToFind account.Account) (account.Account, error)
- func (r *AccountRepository) GetAll() ([]account.Account, error)
- func (r *AccountRepository) Update(account account.Account) (account.Account, error)
- type AdminModel
- type AdminRepository
- func (r *AdminRepository) Create(admin admin.Admin) (admin.Admin, error)
- func (r *AdminRepository) Delete(admin admin.Admin) error
- func (r *AdminRepository) Find(admin admin.Admin) (admin.Admin, error)
- func (r *AdminRepository) GetAll() ([]admin.Admin, error)
- func (r *AdminRepository) Update(admin admin.Admin) (admin.Admin, error)
- type AppModel
- type AppRepository
- type CampaignModel
- type CampaignRepository
- func (r *CampaignRepository) Create(campaign campaign.Campaign) (campaign.Campaign, error)
- func (r *CampaignRepository) Delete(campaign campaign.Campaign) error
- func (r *CampaignRepository) Find(campaignToFind campaign.Campaign) (campaign.Campaign, error)
- func (r *CampaignRepository) GetAll() ([]campaign.Campaign, error)
- type CloudFeedModel
- type CloudFeedRepository
- func (r *CloudFeedRepository) Create(cloudFeed cloudfeed.CloudFeed) (cloudfeed.CloudFeed, error)
- func (r *CloudFeedRepository) Delete(cloudFeed cloudfeed.CloudFeed) error
- func (r *CloudFeedRepository) Find(cloudFeed cloudfeed.CloudFeed) (cloudfeed.CloudFeed, error)
- func (r *CloudFeedRepository) FindDevice(cloudFeed cloudfeed.CloudFeed) (*device.Device, error)
- func (r *CloudFeedRepository) FindFirstTokenToExpire() (uint, uint, needforheat.Time, error)
- func (r *CloudFeedRepository) FindOAuthInfo(accountID uint, cloudFeedID uint) (string, string, string, string, error)
- func (r *CloudFeedRepository) GetAll() ([]cloudfeed.CloudFeed, error)
- func (r *CloudFeedRepository) Update(cloudFeed cloudfeed.CloudFeed) (cloudfeed.CloudFeed, error)
- type CloudFeedTypeModel
- type CloudFeedTypeRepository
- func (r *CloudFeedTypeRepository) Create(cloudFeedType cloudfeedtype.CloudFeedType) (cloudfeedtype.CloudFeedType, error)
- func (r *CloudFeedTypeRepository) Delete(cloudFeedType cloudfeedtype.CloudFeedType) error
- func (r *CloudFeedTypeRepository) Find(cloudFeedType cloudfeedtype.CloudFeedType) (cloudfeedtype.CloudFeedType, error)
- func (r *CloudFeedTypeRepository) GetAll() ([]cloudfeedtype.CloudFeedType, error)
- func (r *CloudFeedTypeRepository) Update(cloudFeedType cloudfeedtype.CloudFeedType) (cloudfeedtype.CloudFeedType, error)
- type DataSourceListItems
- type DataSourceListModel
- type DataSourceListRepository
- func (r *DataSourceListRepository) Create(dataSourceList datasourcelist.DataSourceList) (datasourcelist.DataSourceList, error)
- func (r *DataSourceListRepository) Delete(datasourcelist datasourcelist.DataSourceList) error
- func (r *DataSourceListRepository) Find(datasourceList datasourcelist.DataSourceList) (datasourcelist.DataSourceList, error)
- func (r *DataSourceListRepository) GetAll() ([]datasourcelist.DataSourceList, error)
- type DataSourceTypeModel
- type DataSourceTypeRepository
- func (r *DataSourceTypeRepository) Create(datasourcetype datasourcetype.DataSourceType) (datasourcetype.DataSourceType, error)
- func (r *DataSourceTypeRepository) Delete(datasourcetype datasourcetype.DataSourceType) error
- func (r *DataSourceTypeRepository) Find(shoppingListItem datasourcetype.DataSourceType) (datasourcetype.DataSourceType, error)
- func (r *DataSourceTypeRepository) GetAll() ([]datasourcetype.DataSourceType, error)
- type DeviceModel
- type DeviceRepository
- func (r *DeviceRepository) Create(device device.Device) (device.Device, error)
- func (r *DeviceRepository) Delete(device device.Device) error
- func (r *DeviceRepository) Find(device device.Device) (device.Device, error)
- func (r *DeviceRepository) FindCloudFeedAuthCreationTimeFromDeviceID(deviceID uint) (*needforheat.Time, error)
- func (r *DeviceRepository) GetAll() ([]device.Device, error)
- func (r *DeviceRepository) GetAllByAccount(accountID uint) ([]device.Device, error)
- func (r *DeviceRepository) GetMeasurements(device device.Device, filters map[string]string) ([]measurement.Measurement, error)
- func (r *DeviceRepository) GetProperties(device device.Device) ([]property.Property, error)
- func (r *DeviceRepository) Update(device device.Device) (device.Device, error)
- type DeviceTypeModel
- type DeviceTypeRepository
- func (r *DeviceTypeRepository) Create(deviceType devicetype.DeviceType) (devicetype.DeviceType, error)
- func (r *DeviceTypeRepository) Delete(deviceType devicetype.DeviceType) error
- func (r *DeviceTypeRepository) Find(deviceType devicetype.DeviceType) (devicetype.DeviceType, error)
- func (r *DeviceTypeRepository) GetAll() ([]devicetype.DeviceType, error)
- type EnergyQueryModel
- type EnergyQueryRepository
- func (r *EnergyQueryRepository) Create(energyQuery energyquery.EnergyQuery) (energyquery.EnergyQuery, error)
- func (r *EnergyQueryRepository) Delete(energyQuery energyquery.EnergyQuery) error
- func (r *EnergyQueryRepository) Find(energyQuery energyquery.EnergyQuery) (energyquery.EnergyQuery, error)
- func (r *EnergyQueryRepository) GetAll() ([]energyquery.EnergyQuery, error)
- func (r *EnergyQueryRepository) GetAllByAccount(accountID uint) ([]energyquery.EnergyQuery, error)
- func (r *EnergyQueryRepository) GetMeasurements(energyQuery energyquery.EnergyQuery, filters map[string]string) ([]measurement.Measurement, error)
- func (r *EnergyQueryRepository) GetProperties(energyQuery energyquery.EnergyQuery) ([]property.Property, error)
- func (r *EnergyQueryRepository) Update(energyQuery energyquery.EnergyQuery) (energyquery.EnergyQuery, error)
- type EnergyQueryTypeModel
- type EnergyQueryTypeRepository
- func (r *EnergyQueryTypeRepository) Create(energyQueryType energyquerytype.EnergyQueryType) (energyquerytype.EnergyQueryType, error)
- func (r *EnergyQueryTypeRepository) Delete(energyQueryType energyquerytype.EnergyQueryType) error
- func (r *EnergyQueryTypeRepository) Find(energyQueryType energyquerytype.EnergyQueryType) (energyquerytype.EnergyQueryType, error)
- func (r *EnergyQueryTypeRepository) GetAll() ([]energyquerytype.EnergyQueryType, error)
- type MeasurementModel
- type PropertyModel
- type PropertyRepository
- func (r *PropertyRepository) Create(property property.Property) (property.Property, error)
- func (r *PropertyRepository) Delete(property property.Property) error
- func (r *PropertyRepository) Find(property property.Property) (property.Property, error)
- func (r *PropertyRepository) GetAll() ([]property.Property, error)
- type UploadModel
- type UploadRepository
- func (r *UploadRepository) Create(upload upload.Upload) (upload.Upload, error)
- func (r *UploadRepository) Delete(upload upload.Upload) error
- func (r *UploadRepository) Find(upload upload.Upload) (upload.Upload, error)
- func (r *UploadRepository) GetAll() ([]upload.Upload, error)
- func (r *UploadRepository) GetLatestUploadForDeviceWithID(id uint) (upload.Upload, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDatabaseConnection ¶
Create a new database connection that can be used by repositories.
func NewDatabaseConnectionAndMigrate ¶
Create a new database connection and perform a migration. Try until connection succeeds or context is done.
func StringToCategory ¶
func StringToCategory(category string) datasourcetype.Category
func StringToType ¶
func StringToType(category string) upload.InstanceType
Types ¶
type APIKeyModel ¶
Database representation of a apikey.APIKey
func MakeAPIKeyModel ¶
func MakeAPIKeyModel(apiKey apikey.APIKey) APIKeyModel
Create a APIKeyModel from a apikey.APIKey.
func (APIKeyModel) TableName ¶
func (APIKeyModel) TableName() string
Set the name of the table in the database.
type APIKeyRepository ¶
type APIKeyRepository struct {
// contains filtered or unexported fields
}
func NewAPIKeyRepository ¶
func NewAPIKeyRepository(db *gorm.DB) *APIKeyRepository
Create a new APIKeyRepository.
type AccountModel ¶
type AccountModel struct { gorm.Model CampaignModelID uint `gorm:"column:campaign_id"` Campaign CampaignModel ActivatedAt *needforheat.Time CloudFeeds []CloudFeedModel `gorm:"foreignKey:AccountID"` Devices []DeviceModel }
Database representation of a account.Account.
func MakeAccountModel ¶
func MakeAccountModel(account account.Account) AccountModel
Create a new AccountModel from a account.Account.
func (AccountModel) TableName ¶
func (AccountModel) TableName() string
Set the name of the table in the database.
type AccountRepository ¶
type AccountRepository struct {
// contains filtered or unexported fields
}
func NewAccountRepository ¶
func NewAccountRepository(db *gorm.DB) *AccountRepository
func (*AccountRepository) Delete ¶
func (r *AccountRepository) Delete(account account.Account) error
type AdminModel ¶
type AdminModel struct { gorm.Model Name string `gorm:"unique;not null"` ActivatedAt time.Time Expiry time.Time }
Database representation of a admin.Admin.
func MakeAdminModel ¶
func MakeAdminModel(admin admin.Admin) AdminModel
Create a new AdminModel from a admin.Admin.
func (AdminModel) TableName ¶
func (AdminModel) TableName() string
Set the name of the table in the database.
type AdminRepository ¶
type AdminRepository struct {
// contains filtered or unexported fields
}
func NewAdminRepository ¶
func NewAdminRepository(fileName string) (*AdminRepository, error)
Create a new AdminRepository from a badger DB at fileName.
type AppModel ¶
type AppModel struct { gorm.Model Name string `gorm:"unique;not null"` ProvisioningURLTemplate string OauthRedirectURL string }
Database representation of a app.App.
type AppRepository ¶
type AppRepository struct {
// contains filtered or unexported fields
}
func NewAppRepository ¶
func NewAppRepository(db *gorm.DB) *AppRepository
type CampaignModel ¶
type CampaignModel struct { gorm.Model Name string `gorm:"unique;not null"` AppModelID uint `gorm:"column:app_id"` App AppModel InfoURL string `gorm:"unique;not null"` StartTime *needforheat.Time EndTime *needforheat.Time DataSourceListID uint }
Database representation of campaign.Campaign.
func MakeCampaignModel ¶
func MakeCampaignModel(campaign campaign.Campaign) CampaignModel
Create a new CampaignModel from a [needforheat.campaign].
func (CampaignModel) TableName ¶
func (CampaignModel) TableName() string
Set the name of the table in the database.
type CampaignRepository ¶
type CampaignRepository struct {
// contains filtered or unexported fields
}
func NewCampaignRepository ¶
func NewCampaignRepository(db *gorm.DB) *CampaignRepository
func (*CampaignRepository) Delete ¶
func (r *CampaignRepository) Delete(campaign campaign.Campaign) error
type CloudFeedModel ¶
type CloudFeedModel struct { AccountID uint `gorm:"primaryKey;autoIncrement:false"` CloudFeedTypeID uint `gorm:"primaryKey;autoIncrement:false"` CreatedAt needforheat.Time UpdatedAt needforheat.Time DeletedAt gorm.DeletedAt `gorm:"index"` // TODO: WARNING encrypted string encryption not yet implemented. AccessToken encryption.EncryptedString RefreshToken encryption.EncryptedString Expiry needforheat.Time AuthGrantToken encryption.EncryptedString ActivatedAt *needforheat.Time }
Database representation of cloudfeed.CloudFeed.
func MakeCloudFeedModel ¶
func MakeCloudFeedModel(cloudFeed cloudfeed.CloudFeed) CloudFeedModel
Create a new CloudFeedModel from a [needforheat.cloudFeed].
func (CloudFeedModel) TableName ¶
func (CloudFeedModel) TableName() string
Set the name of the table in the database.
type CloudFeedRepository ¶
type CloudFeedRepository struct {
// contains filtered or unexported fields
}
func NewCloudFeedRepository ¶
func NewCloudFeedRepository(db *gorm.DB) *CloudFeedRepository
func (*CloudFeedRepository) Delete ¶
func (r *CloudFeedRepository) Delete(cloudFeed cloudfeed.CloudFeed) error
func (*CloudFeedRepository) FindDevice ¶
func (*CloudFeedRepository) FindFirstTokenToExpire ¶
func (r *CloudFeedRepository) FindFirstTokenToExpire() (uint, uint, needforheat.Time, error)
func (*CloudFeedRepository) FindOAuthInfo ¶
type CloudFeedTypeModel ¶
type CloudFeedTypeModel struct { gorm.Model Name string `gorm:"unique;not null"` AuthorizationURL string TokenURL string ClientID string // TODO: WARNING EncryptedString still has to implement the encryption. ClientSecret encryption.EncryptedString Scope string RedirectURL string CloudFeeds []CloudFeedModel `gorm:"foreignKey:CloudFeedTypeID"` DataSourceTypes []DataSourceTypeModel `gorm:"polymorphic:TypeInstance;"` }
Database representation of a cloudfeed.CloudFeed
func MakeCloudFeedTypeModel ¶
func MakeCloudFeedTypeModel(cloudFeedType cloudfeedtype.CloudFeedType) CloudFeedTypeModel
Create a CloudFeedTypeModel from a cloudfeedtype.CloudFeedtype.
func (CloudFeedTypeModel) TableName ¶
func (CloudFeedTypeModel) TableName() string
Set the name of the table in the database.
type CloudFeedTypeRepository ¶
type CloudFeedTypeRepository struct {
// contains filtered or unexported fields
}
func NewCloudFeedTypeRepository ¶
func NewCloudFeedTypeRepository(db *gorm.DB) *CloudFeedTypeRepository
Create a new CloudFeedTypeRepository.
func (*CloudFeedTypeRepository) Create ¶
func (r *CloudFeedTypeRepository) Create(cloudFeedType cloudfeedtype.CloudFeedType) (cloudfeedtype.CloudFeedType, error)
func (*CloudFeedTypeRepository) Delete ¶
func (r *CloudFeedTypeRepository) Delete(cloudFeedType cloudfeedtype.CloudFeedType) error
func (*CloudFeedTypeRepository) Find ¶
func (r *CloudFeedTypeRepository) Find(cloudFeedType cloudfeedtype.CloudFeedType) (cloudfeedtype.CloudFeedType, error)
func (*CloudFeedTypeRepository) GetAll ¶
func (r *CloudFeedTypeRepository) GetAll() ([]cloudfeedtype.CloudFeedType, error)
func (*CloudFeedTypeRepository) Update ¶
func (r *CloudFeedTypeRepository) Update(cloudFeedType cloudfeedtype.CloudFeedType) (cloudfeedtype.CloudFeedType, error)
type DataSourceListItems ¶
type DataSourceListItems struct { ID uint DataSourceListModelID uint DataSourceTypeModelID uint Order uint }
Custom Many2Many table to support duplicates and list order
func (DataSourceListItems) TableName ¶
func (DataSourceListItems) TableName() string
type DataSourceListModel ¶
type DataSourceListModel struct { gorm.Model Items []DataSourceListItems Campaign []CampaignModel `gorm:"foreignKey:DataSourceListID"` Name string }
Database representation of a datasourcelist.DataSourceList.
func MakeDataSourceListModel ¶
func MakeDataSourceListModel(dataSourceList datasourcelist.DataSourceList) DataSourceListModel
Create a new DataSourceListModel from a datasourcelist.DataSourceList
func (DataSourceListModel) TableName ¶
func (DataSourceListModel) TableName() string
Set the name of the table in the database.
type DataSourceListRepository ¶
type DataSourceListRepository struct {
// contains filtered or unexported fields
}
func NewDataSourceListRepository ¶
func NewDataSourceListRepository(db *gorm.DB) *DataSourceListRepository
func (*DataSourceListRepository) Create ¶
func (r *DataSourceListRepository) Create(dataSourceList datasourcelist.DataSourceList) (datasourcelist.DataSourceList, error)
func (*DataSourceListRepository) Delete ¶
func (r *DataSourceListRepository) Delete(datasourcelist datasourcelist.DataSourceList) error
func (*DataSourceListRepository) Find ¶
func (r *DataSourceListRepository) Find(datasourceList datasourcelist.DataSourceList) (datasourcelist.DataSourceList, error)
func (*DataSourceListRepository) GetAll ¶
func (r *DataSourceListRepository) GetAll() ([]datasourcelist.DataSourceList, error)
type DataSourceTypeModel ¶
type DataSourceTypeModel struct { gorm.Model TypeInstanceID uint TypeInstanceType string //Category in API Order uint `gorm:"-"` //Used for returning the Order with DataSourceList InstallationManualURL string FAQURL string InfoURL string Precedes []DataSourceTypeModel `gorm:"many2many:data_source_precedence;"` UploadSchedule string `gorm:"type:text"` MeasurementSchedule string `gorm:"type:text"` NotificationThreshold string }
Database representation of a datasourcetype.DataSourceType.
func MakeDataSourceTypeModel ¶
func MakeDataSourceTypeModel(datasourcetype datasourcetype.DataSourceType) DataSourceTypeModel
Create a new DataSourceTypeModel from a datasourcetype.ShoppinglistItem
func (*DataSourceTypeModel) AfterSave ¶
func (s *DataSourceTypeModel) AfterSave(tx *gorm.DB) (err error)
Check if we did not make a loop that can softlock the app
func (*DataSourceTypeModel) CheckforCircular ¶
func (s *DataSourceTypeModel) CheckforCircular(item *DataSourceTypeModel, previousIDs []uint) bool
func (DataSourceTypeModel) TableName ¶
func (DataSourceTypeModel) TableName() string
Set the name of the table in the database.
type DataSourceTypeRepository ¶
type DataSourceTypeRepository struct {
// contains filtered or unexported fields
}
func NewDataSourceTypeRepository ¶
func NewDataSourceTypeRepository(db *gorm.DB) *DataSourceTypeRepository
func (*DataSourceTypeRepository) Create ¶
func (r *DataSourceTypeRepository) Create(datasourcetype datasourcetype.DataSourceType) (datasourcetype.DataSourceType, error)
func (*DataSourceTypeRepository) Delete ¶
func (r *DataSourceTypeRepository) Delete(datasourcetype datasourcetype.DataSourceType) error
func (*DataSourceTypeRepository) Find ¶
func (r *DataSourceTypeRepository) Find(shoppingListItem datasourcetype.DataSourceType) (datasourcetype.DataSourceType, error)
func (*DataSourceTypeRepository) GetAll ¶
func (r *DataSourceTypeRepository) GetAll() ([]datasourcetype.DataSourceType, error)
type DeviceModel ¶
type DeviceModel struct { gorm.Model Name string `gorm:"unique;not null"` DeviceTypeModelID uint `gorm:"column:device_type_id"` DeviceType DeviceTypeModel AccountModelID uint `gorm:"column:account_id"` ActivationSecretHash string ActivatedAt *needforheat.Time Uploads []UploadModel `gorm:"polymorphic:Instance;"` }
Database representation of a device.Device
func MakeDeviceModel ¶
func MakeDeviceModel(device device.Device) DeviceModel
Create a DeviceModel from a device.Device.
func (DeviceModel) TableName ¶
func (DeviceModel) TableName() string
Set the name of the table in the database.
type DeviceRepository ¶
type DeviceRepository struct {
// contains filtered or unexported fields
}
func NewDeviceRepository ¶
func NewDeviceRepository(db *gorm.DB) *DeviceRepository
Create a new DeviceRepository.
func (*DeviceRepository) FindCloudFeedAuthCreationTimeFromDeviceID ¶
func (r *DeviceRepository) FindCloudFeedAuthCreationTimeFromDeviceID(deviceID uint) (*needforheat.Time, error)
func (*DeviceRepository) GetAllByAccount ¶
func (r *DeviceRepository) GetAllByAccount(accountID uint) ([]device.Device, error)
func (*DeviceRepository) GetMeasurements ¶
func (r *DeviceRepository) GetMeasurements(device device.Device, filters map[string]string) ([]measurement.Measurement, error)
func (*DeviceRepository) GetProperties ¶
type DeviceTypeModel ¶
type DeviceTypeModel struct { gorm.Model Name string `gorm:"unique;non null"` DataSourceTypes []DataSourceTypeModel `gorm:"polymorphic:TypeInstance;"` }
Database representation of a devicetype.DeviceType
func MakeDeviceTypeModel ¶
func MakeDeviceTypeModel(deviceType devicetype.DeviceType) DeviceTypeModel
Create a DeviceTypeModel from a devicetype.DeviceType.
func (DeviceTypeModel) TableName ¶
func (DeviceTypeModel) TableName() string
Set the name of the table in the database.
type DeviceTypeRepository ¶
type DeviceTypeRepository struct {
// contains filtered or unexported fields
}
func NewDeviceTypeRepository ¶
func NewDeviceTypeRepository(db *gorm.DB) *DeviceTypeRepository
Create a new DeviceTypeRepository.
func (*DeviceTypeRepository) Create ¶
func (r *DeviceTypeRepository) Create(deviceType devicetype.DeviceType) (devicetype.DeviceType, error)
func (*DeviceTypeRepository) Delete ¶
func (r *DeviceTypeRepository) Delete(deviceType devicetype.DeviceType) error
func (*DeviceTypeRepository) Find ¶
func (r *DeviceTypeRepository) Find(deviceType devicetype.DeviceType) (devicetype.DeviceType, error)
func (*DeviceTypeRepository) GetAll ¶
func (r *DeviceTypeRepository) GetAll() ([]devicetype.DeviceType, error)
type EnergyQueryModel ¶
type EnergyQueryModel struct { gorm.Model EnergyQueryTypeModelID uint `gorm:"column:energy_query_type_id"` EnergyQueryType EnergyQueryTypeModel AccountModelID uint `gorm:"column:account_id"` ActivatedAt *needforheat.Time Uploads []UploadModel `gorm:"polymorphic:Instance;"` }
Database representation of a energyquery.EnergyQuery
func MakeEnergyQueryModel ¶
func MakeEnergyQueryModel(energyQuery energyquery.EnergyQuery) EnergyQueryModel
Create a EnergyQueryModel from a [EnergyQuery.EnergyQuery].
func (EnergyQueryModel) TableName ¶
func (EnergyQueryModel) TableName() string
Set the name of the table in the database.
type EnergyQueryRepository ¶
type EnergyQueryRepository struct {
// contains filtered or unexported fields
}
func NewEnergyQueryRepository ¶
func NewEnergyQueryRepository(db *gorm.DB) *EnergyQueryRepository
Create a new EnergyQueryRepository.
func (*EnergyQueryRepository) Create ¶
func (r *EnergyQueryRepository) Create(energyQuery energyquery.EnergyQuery) (energyquery.EnergyQuery, error)
func (*EnergyQueryRepository) Delete ¶
func (r *EnergyQueryRepository) Delete(energyQuery energyquery.EnergyQuery) error
func (*EnergyQueryRepository) Find ¶
func (r *EnergyQueryRepository) Find(energyQuery energyquery.EnergyQuery) (energyquery.EnergyQuery, error)
func (*EnergyQueryRepository) GetAll ¶
func (r *EnergyQueryRepository) GetAll() ([]energyquery.EnergyQuery, error)
func (*EnergyQueryRepository) GetAllByAccount ¶
func (r *EnergyQueryRepository) GetAllByAccount(accountID uint) ([]energyquery.EnergyQuery, error)
func (*EnergyQueryRepository) GetMeasurements ¶
func (r *EnergyQueryRepository) GetMeasurements(energyQuery energyquery.EnergyQuery, filters map[string]string) ([]measurement.Measurement, error)
func (*EnergyQueryRepository) GetProperties ¶
func (r *EnergyQueryRepository) GetProperties(energyQuery energyquery.EnergyQuery) ([]property.Property, error)
func (*EnergyQueryRepository) Update ¶
func (r *EnergyQueryRepository) Update(energyQuery energyquery.EnergyQuery) (energyquery.EnergyQuery, error)
type EnergyQueryTypeModel ¶
type EnergyQueryTypeModel struct { gorm.Model Name string `gorm:"column:energy_query_variety"` Formula string DataSourceTypes []DataSourceTypeModel `gorm:"polymorphic:TypeInstance;"` }
Database representation of a energyquerytype.EnergyQueryType
func MakeEnergyQueryTypeModel ¶
func MakeEnergyQueryTypeModel(energyQueryType energyquerytype.EnergyQueryType) EnergyQueryTypeModel
Create a EnergyQueryTypeModel from a [EnergyQueryType.EnergyQueryType].
func (EnergyQueryTypeModel) TableName ¶
func (EnergyQueryTypeModel) TableName() string
Set the name of the table in the database.
type EnergyQueryTypeRepository ¶
type EnergyQueryTypeRepository struct {
// contains filtered or unexported fields
}
func NewEnergyQueryTypeRepository ¶
func NewEnergyQueryTypeRepository(db *gorm.DB) *EnergyQueryTypeRepository
Create a new EnergyQueryTypeRepository.
func (*EnergyQueryTypeRepository) Create ¶
func (r *EnergyQueryTypeRepository) Create(energyQueryType energyquerytype.EnergyQueryType) (energyquerytype.EnergyQueryType, error)
func (*EnergyQueryTypeRepository) Delete ¶
func (r *EnergyQueryTypeRepository) Delete(energyQueryType energyquerytype.EnergyQueryType) error
func (*EnergyQueryTypeRepository) Find ¶
func (r *EnergyQueryTypeRepository) Find(energyQueryType energyquerytype.EnergyQueryType) (energyquerytype.EnergyQueryType, error)
func (*EnergyQueryTypeRepository) GetAll ¶
func (r *EnergyQueryTypeRepository) GetAll() ([]energyquerytype.EnergyQueryType, error)
type MeasurementModel ¶
type MeasurementModel struct { gorm.Model PropertyModelID uint `gorm:"column:property_id"` Property PropertyModel UploadModelID uint `gorm:"column:upload_id"` Time time.Time Value string }
Database representation of a measurement.Measurement
func MakeMeasurementModel ¶
func MakeMeasurementModel(measurement measurement.Measurement) MeasurementModel
Create a MeasurementModel from a measurement.Measurement.
func (MeasurementModel) TableName ¶
func (MeasurementModel) TableName() string
Set the name of the table in the database.
type PropertyModel ¶
Database representation of a property.Property
func MakePropertyModel ¶
func MakePropertyModel(property property.Property) PropertyModel
Create a PropertyModel from a property.Property.
func (PropertyModel) TableName ¶
func (PropertyModel) TableName() string
Set the name of the table in the database.
type PropertyRepository ¶
type PropertyRepository struct {
// contains filtered or unexported fields
}
func NewPropertyRepository ¶
func NewPropertyRepository(db *gorm.DB) *PropertyRepository
Create a new PropertyRepository.
func (*PropertyRepository) Delete ¶
func (r *PropertyRepository) Delete(property property.Property) error
type UploadModel ¶
type UploadModel struct { gorm.Model InstanceID uint `gorm:"column:instance_id"` InstanceType upload.InstanceType `gorm:"default:device"` ServerTime needforheat.Time DeviceTime needforheat.Time Size int Measurements []MeasurementModel }
Database representation of a upload.Upload
func MakeUploadModel ¶
func MakeUploadModel(upload upload.Upload) UploadModel
Create an UploadModel from a upload.Upload.
func (UploadModel) TableName ¶
func (UploadModel) TableName() string
Set the name of the table in the database.
type UploadRepository ¶
type UploadRepository struct {
// contains filtered or unexported fields
}
func NewUploadRepository ¶
func NewUploadRepository(db *gorm.DB) *UploadRepository
Create a new UploadRepository.
func (*UploadRepository) GetLatestUploadForDeviceWithID ¶
func (r *UploadRepository) GetLatestUploadForDeviceWithID(id uint) (upload.Upload, error)