Documentation ¶
Index ¶
- Constants
- Variables
- func Logger(ctx context.Context) *zap.Logger
- type ActivityRepository
- func (r *ActivityRepository) QueryProjectActivityStations(ctx context.Context, projectID int64, pageSize, offset int32) ([]*data.Station, error)
- func (r *ActivityRepository) QueryProjectUpdate(ctx context.Context, projectID int64, pageSize, offset int32) ([]*data.ProjectUpdateWM, error)
- func (r *ActivityRepository) QueryStationDeployed(ctx context.Context, projectID, stationID *int64, pageSize, offset int32) ([]*data.StationDeployedWM, error)
- func (r *ActivityRepository) QueryStationIngested(ctx context.Context, projectID, stationID *int64, pageSize, offset int32) ([]*data.StationIngestionWM, error)
- type AllModuleMeta
- func (moduleMeta *AllModuleMeta) All() []*ModuleMeta
- func (moduleMeta *AllModuleMeta) FindModuleMeta(m *HeaderFields) (mm *ModuleMeta, err error)
- func (moduleMeta *AllModuleMeta) FindSensorByFullKey(fullKey string) *SensorAndModuleMeta
- func (moduleMeta *AllModuleMeta) FindSensorMeta(m *HeaderFields, sensor string) (mm *ModuleMeta, sm *SensorMeta, err error)
- type AssociatedStation
- type AttributesRepository
- type BookmarkRepository
- type CountingReader
- type DataMetaModule
- type DataMetaSensor
- type DataMetaStation
- type DataMetaStationFirmware
- type DataSummary
- type DescribesExport
- type DiscussionRepository
- func (r *DiscussionRepository) AddPost(ctx context.Context, post *data.DiscussionPost) (*data.DiscussionPost, error)
- func (r *DiscussionRepository) DeletePostByID(ctx context.Context, id int64) error
- func (r *DiscussionRepository) QueryByProjectID(ctx context.Context, id int32) (*data.PageOfDiscussion, error)
- func (r *DiscussionRepository) QueryByStationIDs(ctx context.Context, ids []int32) (*data.PageOfDiscussion, error)
- func (r *DiscussionRepository) QueryPostByID(ctx context.Context, id int64) (*data.DiscussionPost, error)
- func (r *DiscussionRepository) UpdatePostByID(ctx context.Context, post *data.DiscussionPost) (*data.DiscussionPost, error)
- type EssentialQueryParams
- type EventRepository
- func (r *EventRepository) AddDataEvent(ctx context.Context, event *data.DataEvent) (*data.DataEvent, error)
- func (r *EventRepository) DeleteEventByID(ctx context.Context, id int64) error
- func (r *EventRepository) QueryByProjectIDs(ctx context.Context, ids []int32) (*data.DataEvents, error)
- func (r *EventRepository) QueryByStationIDs(ctx context.Context, ids []int32) (*data.DataEvents, error)
- func (r *EventRepository) QueryEventByID(ctx context.Context, id int64) (*data.DataEvent, error)
- func (r *EventRepository) UpdateEventByID(ctx context.Context, event *data.DataEvent) (*data.DataEvent, error)
- type ExportRepository
- func (r *ExportRepository) AddDataExport(ctx context.Context, de *data.DataExport) (i *data.DataExport, err error)
- func (r *ExportRepository) AddDataExportWithArgs(ctx context.Context, de *data.DataExport, args interface{}) (i *data.DataExport, err error)
- func (r *ExportRepository) QueryByID(ctx context.Context, id int64) (i *data.DataExport, err error)
- func (r *ExportRepository) QueryByToken(ctx context.Context, token string) (i *data.DataExport, err error)
- func (r *ExportRepository) QueryByUserID(ctx context.Context, userID int32) (i []*data.DataExport, err error)
- func (r *ExportRepository) UpdateDataExport(ctx context.Context, de *data.DataExport) (i *data.DataExport, err error)
- type Filter
- type FilteredRecord
- type Filtering
- type HeaderFields
- type IngestionRepository
- func (r *IngestionRepository) AddAndQueue(ctx context.Context, ingestion *data.Ingestion) (queueID int64, err error)
- func (r *IngestionRepository) Delete(ctx context.Context, ingestionID int64) (err error)
- func (r *IngestionRepository) Enqueue(ctx context.Context, ingestionID int64) (int64, error)
- func (r *IngestionRepository) MarkProcessedDone(ctx context.Context, queuedID, totalRecords, metaErrors, dataErrors int64) error
- func (r *IngestionRepository) MarkProcessedHasOtherErrors(ctx context.Context, queuedID int64) error
- func (r *IngestionRepository) QueryByID(ctx context.Context, id int64) (i *data.Ingestion, err error)
- func (r *IngestionRepository) QueryByStationID(ctx context.Context, id int32) (all []*data.Ingestion, err error)
- func (r *IngestionRepository) QueryPending(ctx context.Context) (all []*data.QueuedIngestion, err error)
- func (r *IngestionRepository) QueryQueuedByID(ctx context.Context, queuedID int64) (i *data.QueuedIngestion, err error)
- type InterestingnessRepository
- type LoadedMedia
- type MalformedMetaError
- type MatchedFilters
- type MediaRepository
- func (r *MediaRepository) DeleteByURL(ctx context.Context, url string) (err error)
- func (r *MediaRepository) LoadByURL(ctx context.Context, url string) (lm *LoadedMedia, err error)
- func (r *MediaRepository) Save(ctx context.Context, reader io.ReadCloser, contentLength int64, ...) (sm *SavedMedia, err error)
- type MetaFactory
- type MissingSensorMetaError
- type ModuleHeader
- type ModuleMeta
- type ModuleMetaRepository
- func (r *ModuleMetaRepository) FindAllModulesMeta(ctx context.Context) (mm *AllModuleMeta, err error)
- func (r *ModuleMetaRepository) FindByFullKey(ctx context.Context, fullKey string) (mm *SensorAndModuleMeta, err error)
- func (r *ModuleMetaRepository) FindModuleMeta(ctx context.Context, m *HeaderFields) (mm *ModuleMeta, err error)
- func (r *ModuleMetaRepository) FindSensorMeta(ctx context.Context, m *HeaderFields, sensor string) (mm *ModuleMeta, sm *SensorMeta, err error)
- type NearbyStation
- type NotificationRepository
- func (r *NotificationRepository) AddNotification(ctx context.Context, notification *data.Notification) (*data.Notification, error)
- func (r *NotificationRepository) DeleteByPostID(ctx context.Context, postID int64) error
- func (r *NotificationRepository) MarkNotificationSeen(ctx context.Context, userID int32, id int64) error
- func (r *NotificationRepository) QueryByUserID(ctx context.Context, userID int32) ([]*data.NotificationPost, error)
- type PersistedModuleMeta
- type PersistedSensorMeta
- type ProjectRepository
- func (pr *ProjectRepository) AddDefaultProject(ctx context.Context, user *data.User) (project *data.Project, err error)
- func (pr *ProjectRepository) AddProject(ctx context.Context, userID int32, project *data.Project) (*data.Project, error)
- func (pr *ProjectRepository) AddStationToDefaultProjectMaybe(ctx context.Context, station *data.Station) error
- func (pr *ProjectRepository) AddStationToProjectByID(ctx context.Context, projectID, stationID int32) error
- func (pr *ProjectRepository) Delete(outerCtx context.Context, projectID int32) error
- func (pr *ProjectRepository) QueryByID(ctx context.Context, projectID int32) (*data.Project, error)
- func (pr *ProjectRepository) QueryProjectUser(ctx context.Context, userID, projectID int32) (*data.ProjectUser, error)
- func (pr *ProjectRepository) QueryProjectsByStationIDForPermissions(ctx context.Context, stationID int32) (projects []*data.Project, err error)
- func (pr *ProjectRepository) QueryUserProjectRelationships(ctx context.Context, userID int32) (map[int32]*data.UserProjectRelationship, error)
- type ProvisionRepository
- type QueriedEssential
- type ReadingValue
- type RecordRepository
- func (r *RecordRepository) AddDataRecord(ctx context.Context, p *data.Provision, i *data.Ingestion, dr *pb.DataRecord, ...) (*data.DataRecord, *data.MetaRecord, error)
- func (r *RecordRepository) AddMetaRecord(ctx context.Context, p *data.Provision, i *data.Ingestion, recordNumber int64, ...) (*data.MetaRecord, error)
- func (r *RecordRepository) AddSignedMetaRecord(ctx context.Context, p *data.Provision, i *data.Ingestion, sr *pb.SignedRecord, ...) (*data.MetaRecord, error)
- func (r *RecordRepository) QueryDevice(ctx context.Context, deviceId string, pageNumber, pageSize int) (page *RecordsPage, err error)
- type RecordsPage
- type ResolvedRecord
- type SavedBookmark
- type SavedMedia
- type SensorAndModule
- type SensorAndModuleMeta
- type SensorKey
- type SensorMeta
- type SensorRanges
- type SensorsRepository
- type StationLayout
- type StationLayoutRepository
- type StationNoteRepository
- func (r *StationNoteRepository) AddStationNote(ctx context.Context, note *data.StationNote) (*data.StationNote, error)
- func (r *StationNoteRepository) DeleteStationNoteByID(ctx context.Context, id int32) error
- func (r *StationNoteRepository) QueryByStationID(ctx context.Context, id int32) (*data.StationNotesWithUsers, error)
- func (r *StationNoteRepository) QueryStationNoteByID(ctx context.Context, id int32) (*data.StationNote, error)
- func (r *StationNoteRepository) UpdateStationNoteByID(ctx context.Context, note *data.StationNote) (*data.StationNote, error)
- type StationRepository
- func (r *StationRepository) AddStation(ctx context.Context, adding *data.Station) (station *data.Station, err error)
- func (r *StationRepository) AssociateStations(ctx context.Context, stationID, associatedStationID, priority int32) (err error)
- func (r *StationRepository) ClearAssociatedStations(ctx context.Context, stationID int32) error
- func (sr *StationRepository) Delete(ctx context.Context, stationID int32) error
- func (r *StationRepository) FindOrCreateStationModel(ctx context.Context, ttnSchemaID int32, name string) (model *data.StationModel, err error)
- func (r *StationRepository) QueryAllStationsByModelID(ctx context.Context, modelID int32) (stations []*data.Station, err error)
- func (r *StationRepository) QueryAssociatedStations(ctx context.Context, stationIDs []int32) (map[int32][]*AssociatedStation, error)
- func (sr *StationRepository) QueryEssentialStations(ctx context.Context, qp *EssentialQueryParams) (*QueriedEssential, error)
- func (r *StationRepository) QueryNearbyProjectStations(ctx context.Context, projectID int32, location *data.Location) ([]*NearbyStation, error)
- func (r *StationRepository) QueryStationByArbitraryDeviceID(ctx context.Context, deviceIdBytes []byte) (station *data.Station, err error)
- func (r *StationRepository) QueryStationByDeviceID(ctx context.Context, deviceIdBytes []byte) (station *data.Station, err error)
- func (r *StationRepository) QueryStationByID(ctx context.Context, id int32) (station *data.Station, err error)
- func (r *StationRepository) QueryStationByPhotoID(ctx context.Context, id int32) (station *data.Station, err error)
- func (r *StationRepository) QueryStationConfigurationByMetaID(ctx context.Context, metaRecordID int64) (*data.StationConfiguration, error)
- func (r *StationRepository) QueryStationFull(ctx context.Context, id int32) (*data.StationFull, error)
- func (r *StationRepository) QueryStationFullByOwnerID(ctx context.Context, id int32) ([]*data.StationFull, error)
- func (r *StationRepository) QueryStationFullByProjectID(ctx context.Context, id int32) ([]*data.StationFull, error)
- func (r *StationRepository) QueryStationModuleByID(ctx context.Context, id int32) (module *data.StationModule, err error)
- func (r *StationRepository) QueryStationModulesByConfigurationID(ctx context.Context, configurationID int64) ([]*data.StationModule, error)
- func (r *StationRepository) QueryStationModulesByHardwareID(ctx context.Context, hardwareID []byte) ([]*data.StationModule, error)
- func (r *StationRepository) QueryStationModulesByMetaID(ctx context.Context, metaRecordID int64) ([]*data.StationModule, error)
- func (r *StationRepository) QueryStationProjectIds(ctx context.Context, stationID int32) ([]int32, error)
- func (sr *StationRepository) QueryStationSensors(ctx context.Context, stations []int32) (map[int32][]*StationSensor, error)
- func (r *StationRepository) QueryStationsByDeviceID(ctx context.Context, deviceIdBytes []byte) (stations []*data.Station, err error)
- func (r *StationRepository) QueryVisibleConfiguration(ctx context.Context, stationID int32) (*data.StationConfiguration, *data.Provision, error)
- func (sr *StationRepository) Search(ctx context.Context, query string) (*QueriedEssential, error)
- func (r *StationRepository) TryQueryStationByDeviceID(ctx context.Context, deviceIdBytes []byte) (station *data.Station, err error)
- func (r *StationRepository) UpdateOwner(ctx context.Context, station *data.Station) (err error)
- func (r *StationRepository) UpdatePhoto(ctx context.Context, station *data.Station) (err error)
- func (r *StationRepository) UpdateStation(ctx context.Context, station *data.Station) (err error)
- func (r *StationRepository) UpdateStationModelFromStatus(ctx context.Context, s *data.Station, rawStatus string) error
- func (r *StationRepository) UpdateStationModule(ctx context.Context, module *data.StationModule) (*data.StationModule, error)
- func (r *StationRepository) UpsertConfiguration(ctx context.Context, configuration *data.StationConfiguration) (*data.StationConfiguration, error)
- func (r *StationRepository) UpsertModuleSensor(ctx context.Context, sensor *data.ModuleSensor) (*data.ModuleSensor, error)
- func (r *StationRepository) UpsertStationModule(ctx context.Context, module *data.StationModule) (*data.StationModule, error)
- func (r *StationRepository) UpsertVisibleConfiguration(ctx context.Context, stationID int32, configurationID int64) error
- type StationSensor
- type StationSensorByOrder
- type StationSensorRow
- type UserRepository
- func (r *UserRepository) Add(ctx context.Context, user *data.User) error
- func (r *UserRepository) Delete(outerCtx context.Context, id int32) (err error)
- func (r *UserRepository) NewRecoveryToken(ctx context.Context, user *data.User, duration time.Duration) (*data.RecoveryToken, error)
- func (r *UserRepository) QueryAdminByEmail(ctx context.Context, email string) (*data.User, error)
- func (r *UserRepository) QueryByEmail(ctx context.Context, email string) (*data.User, error)
- func (r *UserRepository) QueryByID(ctx context.Context, id int32) (*data.User, error)
- func (r *UserRepository) QueryMentionables(ctx context.Context, query string) ([]*data.User, error)
- func (r *UserRepository) Search(ctx context.Context, query string) ([]*data.User, error)
- type VersionMeta
- type VizConfig
- type VizThreshold
- type VizThresholds
Constants ¶
View Source
const ( ManufacturerConservify = 0x01 ConservifyWeather = 0x01 ConservifyAtlas = 0x02 ConservifyDistance = 0x03 ConservifyAtlasPh = 0x04 ConservifyAtlasEc = 0x05 ConservifyAtlasDo = 0x06 ConservifyAtlasTemp = 0x07 ConservifyAtlasOrp = 0x08 ConservifyWaterPh = 0x09 ConservifyWaterEc = 0x10 ConservifyWaterDo = 0x11 ConservifyWaterTemp = 0x12 ConservifyWaterOrp = 0x13 ConservifyRandom = 0xa0 ConservifyDiagnostics = 0xa1 )
View Source
const (
META_INTERNAL_MASK = 0x1
)
View Source
const (
MaximumRequiredHeaderBytes = 262
)
Variables ¶
View Source
var (
StatusReplySourceID = int32(0)
)
Functions ¶
Types ¶
type ActivityRepository ¶
type ActivityRepository struct {
// contains filtered or unexported fields
}
func NewActivityRepository ¶
func NewActivityRepository(db *sqlxcache.DB) (r *ActivityRepository, err error)
func (*ActivityRepository) QueryProjectActivityStations ¶
func (*ActivityRepository) QueryProjectUpdate ¶
func (r *ActivityRepository) QueryProjectUpdate(ctx context.Context, projectID int64, pageSize, offset int32) ([]*data.ProjectUpdateWM, error)
func (*ActivityRepository) QueryStationDeployed ¶
func (r *ActivityRepository) QueryStationDeployed(ctx context.Context, projectID, stationID *int64, pageSize, offset int32) ([]*data.StationDeployedWM, error)
func (*ActivityRepository) QueryStationIngested ¶
func (r *ActivityRepository) QueryStationIngested(ctx context.Context, projectID, stationID *int64, pageSize, offset int32) ([]*data.StationIngestionWM, error)
type AllModuleMeta ¶
type AllModuleMeta struct {
// contains filtered or unexported fields
}
func (*AllModuleMeta) All ¶
func (moduleMeta *AllModuleMeta) All() []*ModuleMeta
func (*AllModuleMeta) FindModuleMeta ¶
func (moduleMeta *AllModuleMeta) FindModuleMeta(m *HeaderFields) (mm *ModuleMeta, err error)
func (*AllModuleMeta) FindSensorByFullKey ¶
func (moduleMeta *AllModuleMeta) FindSensorByFullKey(fullKey string) *SensorAndModuleMeta
func (*AllModuleMeta) FindSensorMeta ¶
func (moduleMeta *AllModuleMeta) FindSensorMeta(m *HeaderFields, sensor string) (mm *ModuleMeta, sm *SensorMeta, err error)
type AssociatedStation ¶
type AttributesRepository ¶
type AttributesRepository struct {
// contains filtered or unexported fields
}
func NewAttributesRepository ¶
func NewAttributesRepository(db *sqlxcache.DB) (rr *AttributesRepository)
func (*AttributesRepository) QueryStationProjectAttributes ¶
func (r *AttributesRepository) QueryStationProjectAttributes(ctx context.Context, stationID int32) ([]*data.StationAttributeSlot, error)
func (*AttributesRepository) UpsertStationAttributes ¶
func (r *AttributesRepository) UpsertStationAttributes(ctx context.Context, attributes []*data.StationProjectAttribute) ([]*data.StationProjectAttribute, error)
type BookmarkRepository ¶
type BookmarkRepository struct {
// contains filtered or unexported fields
}
func NewBookmarkRepository ¶
func NewBookmarkRepository(db *sqlxcache.DB) (rr *BookmarkRepository)
func (*BookmarkRepository) AddNew ¶
func (c *BookmarkRepository) AddNew(ctx context.Context, userID *int32, bookmark string) (*SavedBookmark, error)
func (*BookmarkRepository) Resolve ¶
func (c *BookmarkRepository) Resolve(ctx context.Context, token string) (*SavedBookmark, error)
type CountingReader ¶
type CountingReader struct { BytesRead int64 // contains filtered or unexported fields }
func NewCountingReader ¶
func NewCountingReader(target io.Reader) *CountingReader
type DataMetaModule ¶
type DataMetaModule struct { Position int `json:"position"` Address int `json:"address"` Manufacturer int `json:"manufacturer"` Kind int `json:"kind"` Version int `json:"version"` Name string `json:"name"` ID string `json:"id"` Key string `json:"key"` Sensors []*DataMetaSensor `json:"sensors"` Internal bool `json:"internal"` }
type DataMetaSensor ¶
type DataMetaStation ¶
type DataMetaStation struct { ID string `json:"id"` Name string `json:"name"` Firmware *DataMetaStationFirmware `json:"firmware"` AllModules []*DataMetaModule `json:"all_modules"` }
type DataMetaStationFirmware ¶
type DataSummary ¶
type DescribesExport ¶
type DescribesExport struct {
// contains filtered or unexported fields
}
func NewDescribeEvent ¶
func NewDescribeEvent(db *sqlxcache.DB) *DescribesExport
type DiscussionRepository ¶
type DiscussionRepository struct {
// contains filtered or unexported fields
}
func NewDiscussionRepository ¶
func NewDiscussionRepository(db *sqlxcache.DB) (rr *DiscussionRepository)
func (*DiscussionRepository) AddPost ¶
func (r *DiscussionRepository) AddPost(ctx context.Context, post *data.DiscussionPost) (*data.DiscussionPost, error)
func (*DiscussionRepository) DeletePostByID ¶
func (r *DiscussionRepository) DeletePostByID(ctx context.Context, id int64) error
func (*DiscussionRepository) QueryByProjectID ¶
func (r *DiscussionRepository) QueryByProjectID(ctx context.Context, id int32) (*data.PageOfDiscussion, error)
func (*DiscussionRepository) QueryByStationIDs ¶
func (r *DiscussionRepository) QueryByStationIDs(ctx context.Context, ids []int32) (*data.PageOfDiscussion, error)
func (*DiscussionRepository) QueryPostByID ¶
func (r *DiscussionRepository) QueryPostByID(ctx context.Context, id int64) (*data.DiscussionPost, error)
func (*DiscussionRepository) UpdatePostByID ¶
func (r *DiscussionRepository) UpdatePostByID(ctx context.Context, post *data.DiscussionPost) (*data.DiscussionPost, error)
type EssentialQueryParams ¶
type EventRepository ¶
type EventRepository struct {
// contains filtered or unexported fields
}
func NewEventRepository ¶
func NewEventRepository(db *sqlxcache.DB) (rr *EventRepository)
func (*EventRepository) AddDataEvent ¶
func (*EventRepository) DeleteEventByID ¶
func (r *EventRepository) DeleteEventByID(ctx context.Context, id int64) error
func (*EventRepository) QueryByProjectIDs ¶
func (r *EventRepository) QueryByProjectIDs(ctx context.Context, ids []int32) (*data.DataEvents, error)
func (*EventRepository) QueryByStationIDs ¶
func (r *EventRepository) QueryByStationIDs(ctx context.Context, ids []int32) (*data.DataEvents, error)
func (*EventRepository) QueryEventByID ¶
func (*EventRepository) UpdateEventByID ¶
type ExportRepository ¶
type ExportRepository struct {
// contains filtered or unexported fields
}
func NewExportRepository ¶
func NewExportRepository(db *sqlxcache.DB) (*ExportRepository, error)
func (*ExportRepository) AddDataExport ¶
func (r *ExportRepository) AddDataExport(ctx context.Context, de *data.DataExport) (i *data.DataExport, err error)
func (*ExportRepository) AddDataExportWithArgs ¶
func (r *ExportRepository) AddDataExportWithArgs(ctx context.Context, de *data.DataExport, args interface{}) (i *data.DataExport, err error)
func (*ExportRepository) QueryByID ¶
func (r *ExportRepository) QueryByID(ctx context.Context, id int64) (i *data.DataExport, err error)
func (*ExportRepository) QueryByToken ¶
func (r *ExportRepository) QueryByToken(ctx context.Context, token string) (i *data.DataExport, err error)
func (*ExportRepository) QueryByUserID ¶
func (r *ExportRepository) QueryByUserID(ctx context.Context, userID int32) (i []*data.DataExport, err error)
func (*ExportRepository) UpdateDataExport ¶
func (r *ExportRepository) UpdateDataExport(ctx context.Context, de *data.DataExport) (i *data.DataExport, err error)
type Filter ¶
type Filter interface { Name() string Apply(ctx context.Context, record *ResolvedRecord, filters *MatchedFilters) }
type FilteredRecord ¶
type FilteredRecord struct { Record *ResolvedRecord `json:"record"` Filters *MatchedFilters `json:"filters"` }
type Filtering ¶
type Filtering struct {
// contains filtered or unexported fields
}
func NewFiltering ¶
func NewFiltering() (f *Filtering)
func (*Filtering) Apply ¶
func (f *Filtering) Apply(ctx context.Context, record *ResolvedRecord) *FilteredRecord
type HeaderFields ¶
type IngestionRepository ¶
type IngestionRepository struct {
// contains filtered or unexported fields
}
func NewIngestionRepository ¶
func NewIngestionRepository(db *sqlxcache.DB) (ir *IngestionRepository)
func (*IngestionRepository) AddAndQueue ¶
func (*IngestionRepository) Delete ¶
func (r *IngestionRepository) Delete(ctx context.Context, ingestionID int64) (err error)
func (*IngestionRepository) MarkProcessedDone ¶
func (r *IngestionRepository) MarkProcessedDone(ctx context.Context, queuedID, totalRecords, metaErrors, dataErrors int64) error
func (*IngestionRepository) MarkProcessedHasOtherErrors ¶
func (r *IngestionRepository) MarkProcessedHasOtherErrors(ctx context.Context, queuedID int64) error
func (*IngestionRepository) QueryByStationID ¶
func (*IngestionRepository) QueryPending ¶
func (r *IngestionRepository) QueryPending(ctx context.Context) (all []*data.QueuedIngestion, err error)
func (*IngestionRepository) QueryQueuedByID ¶
func (r *IngestionRepository) QueryQueuedByID(ctx context.Context, queuedID int64) (i *data.QueuedIngestion, err error)
type InterestingnessRepository ¶
type InterestingnessRepository struct {
// contains filtered or unexported fields
}
func NewInterestingnessRepository ¶
func NewInterestingnessRepository(db *sqlxcache.DB) (rr *InterestingnessRepository)
func (*InterestingnessRepository) QueryByStationID ¶
func (r *InterestingnessRepository) QueryByStationID(ctx context.Context, id int32) (map[time.Duration]*data.StationInterestingness, error)
func (*InterestingnessRepository) UpsertInterestingness ¶
func (r *InterestingnessRepository) UpsertInterestingness(ctx context.Context, iness *data.StationInterestingness) (*data.StationInterestingness, error)
type LoadedMedia ¶
type MalformedMetaError ¶
func (*MalformedMetaError) Error ¶
func (e *MalformedMetaError) Error() string
type MatchedFilters ¶
type MatchedFilters struct { Record []string `json:"record"` Readings map[SensorKey][]string `json:"-"` }
func (*MatchedFilters) AddReading ¶
func (mf *MatchedFilters) AddReading(key SensorKey, name string)
func (*MatchedFilters) AddRecord ¶
func (mf *MatchedFilters) AddRecord(name string)
func (*MatchedFilters) IsFiltered ¶
func (mf *MatchedFilters) IsFiltered(sensorKey SensorKey) bool
func (*MatchedFilters) NumberOfReadingsFiltered ¶
func (mf *MatchedFilters) NumberOfReadingsFiltered() int
type MediaRepository ¶
type MediaRepository struct {
// contains filtered or unexported fields
}
func NewMediaRepository ¶
func NewMediaRepository(files files.FileArchive) (r *MediaRepository)
func (*MediaRepository) DeleteByURL ¶
func (r *MediaRepository) DeleteByURL(ctx context.Context, url string) (err error)
func (*MediaRepository) LoadByURL ¶
func (r *MediaRepository) LoadByURL(ctx context.Context, url string) (lm *LoadedMedia, err error)
func (*MediaRepository) Save ¶
func (r *MediaRepository) Save(ctx context.Context, reader io.ReadCloser, contentLength int64, givenContentType string) (sm *SavedMedia, err error)
type MetaFactory ¶
type MetaFactory struct {
// contains filtered or unexported fields
}
func NewMetaFactory ¶
func NewMetaFactory(db *sqlxcache.DB) *MetaFactory
func (*MetaFactory) Add ¶
func (mf *MetaFactory) Add(ctx context.Context, databaseRecord *data.MetaRecord, fq bool) (*VersionMeta, error)
func (*MetaFactory) InOrder ¶
func (mf *MetaFactory) InOrder() []*VersionMeta
func (*MetaFactory) Resolve ¶
func (mf *MetaFactory) Resolve(ctx context.Context, databaseRecord *data.DataRecord, verbose bool, fq bool) (*FilteredRecord, error)
type MissingSensorMetaError ¶
type MissingSensorMetaError struct {
MetaRecordID int64
}
func (*MissingSensorMetaError) Error ¶
func (e *MissingSensorMetaError) Error() string
type ModuleHeader ¶
type ModuleMeta ¶
type ModuleMeta struct { Header ModuleHeader `json:"header"` Key string `json:"key"` Internal bool `json:"internal"` Sensors []*SensorMeta `json:"sensors"` Order int `json:"order"` }
func (*ModuleMeta) Sensor ¶
func (mm *ModuleMeta) Sensor(key string) *SensorMeta
type ModuleMetaRepository ¶
type ModuleMetaRepository struct {
// contains filtered or unexported fields
}
func NewModuleMetaRepository ¶
func NewModuleMetaRepository(db *sqlxcache.DB) *ModuleMetaRepository
func (*ModuleMetaRepository) FindAllModulesMeta ¶
func (r *ModuleMetaRepository) FindAllModulesMeta(ctx context.Context) (mm *AllModuleMeta, err error)
func (*ModuleMetaRepository) FindByFullKey ¶
func (r *ModuleMetaRepository) FindByFullKey(ctx context.Context, fullKey string) (mm *SensorAndModuleMeta, err error)
func (*ModuleMetaRepository) FindModuleMeta ¶
func (r *ModuleMetaRepository) FindModuleMeta(ctx context.Context, m *HeaderFields) (mm *ModuleMeta, err error)
func (*ModuleMetaRepository) FindSensorMeta ¶
func (r *ModuleMetaRepository) FindSensorMeta(ctx context.Context, m *HeaderFields, sensor string) (mm *ModuleMeta, sm *SensorMeta, err error)
type NearbyStation ¶
type NotificationRepository ¶
type NotificationRepository struct {
// contains filtered or unexported fields
}
func NewNotificationRepository ¶
func NewNotificationRepository(db *sqlxcache.DB) (rr *NotificationRepository)
func (*NotificationRepository) AddNotification ¶
func (r *NotificationRepository) AddNotification(ctx context.Context, notification *data.Notification) (*data.Notification, error)
func (*NotificationRepository) DeleteByPostID ¶
func (r *NotificationRepository) DeleteByPostID(ctx context.Context, postID int64) error
func (*NotificationRepository) MarkNotificationSeen ¶
func (*NotificationRepository) QueryByUserID ¶
func (r *NotificationRepository) QueryByUserID(ctx context.Context, userID int32) ([]*data.NotificationPost, error)
type PersistedModuleMeta ¶
type PersistedModuleMeta struct { ID int32 `db:"id" json:"id"` Key string `db:"key" json:"key"` Manufacturer uint32 `db:"manufacturer" json:"manufacturer"` Kinds pq.Int32Array `db:"kinds" json:"kinds"` Version pq.Int32Array `db:"version" json:"version"` Ordering int `db:"ordering" json:"ordering"` Internal bool `db:"internal" json:"internal"` }
type PersistedSensorMeta ¶
type PersistedSensorMeta struct { ID int32 `db:"id" json:"id"` ModuleID int32 `db:"module_id" json:"module_id"` SensorKey string `db:"sensor_key" json:"sensor_key"` FirmwareKey string `db:"firmware_key" json:"firmware_key"` FullKey string `db:"full_key" json:"full_key"` UnitOfMeasure string `db:"uom" json:"uom"` Ordering int `db:"ordering" json:"ordering"` Internal bool `db:"internal" json:"internal"` Strings types.JSONText `db:"strings" json:"strings"` Viz types.JSONText `db:"viz" json:"viz"` Ranges types.JSONText `db:"ranges" json:"ranges"` Aliases *pq.StringArray `db:"aliases" json:"aliases"` AggregationFunction *string `db:"aggregation_function" json:"aggregationFunction"` }
TODO Fix JSON keys
type ProjectRepository ¶
type ProjectRepository struct {
// contains filtered or unexported fields
}
func NewProjectRepository ¶
func NewProjectRepository(db *sqlxcache.DB) (pr *ProjectRepository)
func (*ProjectRepository) AddDefaultProject ¶
func (*ProjectRepository) AddProject ¶
func (*ProjectRepository) AddStationToDefaultProjectMaybe ¶
func (*ProjectRepository) AddStationToProjectByID ¶
func (pr *ProjectRepository) AddStationToProjectByID(ctx context.Context, projectID, stationID int32) error
func (*ProjectRepository) Delete ¶
func (pr *ProjectRepository) Delete(outerCtx context.Context, projectID int32) error
func (*ProjectRepository) QueryProjectUser ¶
func (pr *ProjectRepository) QueryProjectUser(ctx context.Context, userID, projectID int32) (*data.ProjectUser, error)
func (*ProjectRepository) QueryProjectsByStationIDForPermissions ¶
func (*ProjectRepository) QueryUserProjectRelationships ¶
func (pr *ProjectRepository) QueryUserProjectRelationships(ctx context.Context, userID int32) (map[int32]*data.UserProjectRelationship, error)
type ProvisionRepository ¶
type ProvisionRepository struct {
// contains filtered or unexported fields
}
func NewProvisionRepository ¶
func NewProvisionRepository(db *sqlxcache.DB) (r *ProvisionRepository)
func (*ProvisionRepository) QueryOrCreateProvision ¶
type QueriedEssential ¶
type QueriedEssential struct { Stations []*data.EssentialStation Total int32 }
type ReadingValue ¶
type ReadingValue struct { Module *DataMetaModule `json:"module"` Sensor *DataMetaSensor `json:"sensor"` Value float64 `json:"value"` }
type RecordRepository ¶
type RecordRepository struct {
// contains filtered or unexported fields
}
func NewRecordRepository ¶
func NewRecordRepository(db *sqlxcache.DB) *RecordRepository
func (*RecordRepository) AddDataRecord ¶
func (r *RecordRepository) AddDataRecord(ctx context.Context, p *data.Provision, i *data.Ingestion, dr *pb.DataRecord, pb []byte) (*data.DataRecord, *data.MetaRecord, error)
func (*RecordRepository) AddMetaRecord ¶
func (r *RecordRepository) AddMetaRecord(ctx context.Context, p *data.Provision, i *data.Ingestion, recordNumber int64, dr *pb.DataRecord, pb []byte) (*data.MetaRecord, error)
func (*RecordRepository) AddSignedMetaRecord ¶
func (r *RecordRepository) AddSignedMetaRecord(ctx context.Context, p *data.Provision, i *data.Ingestion, sr *pb.SignedRecord, dr *pb.DataRecord, pb []byte) (*data.MetaRecord, error)
func (*RecordRepository) QueryDevice ¶
func (r *RecordRepository) QueryDevice(ctx context.Context, deviceId string, pageNumber, pageSize int) (page *RecordsPage, err error)
type RecordsPage ¶
type RecordsPage struct { Data []*data.DataRecord Meta map[int64]*data.MetaRecord }
type ResolvedRecord ¶
type ResolvedRecord struct { ID int64 `json:"id"` Time int64 `json:"time"` Location []float64 `json:"location"` Readings map[SensorKey]*ReadingValue `json:"-"` }
type SavedBookmark ¶
type SensorAndModule ¶
type SensorAndModule struct { Sensor *DataMetaSensor `json:"sensor"` Module *DataMetaModule `json:"module"` }
type SensorAndModuleMeta ¶
type SensorAndModuleMeta struct { Sensor *SensorMeta `json:"sensor"` Module *ModuleMeta `json:"module"` }
type SensorMeta ¶
type SensorMeta struct { Key string `json:"key"` FullKey string `json:"full_key"` FirmwareKey string `json:"firmware_key"` UnitOfMeasure string `json:"unit_of_measure"` Order int `json:"order"` Ranges []SensorRanges `json:"ranges"` Internal bool `json:"internal"` VizConfigs []VizConfig `json:"viz"` Strings map[string]map[string]string `json:"strings"` Aliases []string `json:"aliases"` AggregationFunction string `json:"aggregationFunction"` }
TODO Fix JSON keys
type SensorRanges ¶
type SensorsRepository ¶
type SensorsRepository struct {
// contains filtered or unexported fields
}
func NewSensorsRepository ¶
func NewSensorsRepository(db *sqlxcache.DB) (rr *SensorsRepository)
func (*SensorsRepository) AddSensor ¶
func (r *SensorsRepository) AddSensor(ctx context.Context, key string) error
func (*SensorsRepository) QueryAllSensors ¶
func (*SensorsRepository) QueryQueryingSpec ¶
func (r *SensorsRepository) QueryQueryingSpec(ctx context.Context) (*data.QueryingSpec, error)
type StationLayout ¶
type StationLayout struct { Configurations []*data.StationConfiguration Modules []*data.StationModule Sensors []*data.ModuleSensor }
type StationLayoutRepository ¶
type StationLayoutRepository struct {
// contains filtered or unexported fields
}
func NewStationLayoutRepository ¶
func NewStationLayoutRepository(db *sqlxcache.DB) (rr *StationLayoutRepository, err error)
func (*StationLayoutRepository) QueryStationLayoutByDeviceID ¶
func (r *StationLayoutRepository) QueryStationLayoutByDeviceID(ctx context.Context, deviceID []byte) (*StationLayout, error)
type StationNoteRepository ¶
type StationNoteRepository struct {
// contains filtered or unexported fields
}
func NewStationNoteRepository ¶
func NewStationNoteRepository(db *sqlxcache.DB) (rr *StationNoteRepository)
func (*StationNoteRepository) AddStationNote ¶
func (r *StationNoteRepository) AddStationNote(ctx context.Context, note *data.StationNote) (*data.StationNote, error)
func (*StationNoteRepository) DeleteStationNoteByID ¶
func (r *StationNoteRepository) DeleteStationNoteByID(ctx context.Context, id int32) error
func (*StationNoteRepository) QueryByStationID ¶
func (r *StationNoteRepository) QueryByStationID(ctx context.Context, id int32) (*data.StationNotesWithUsers, error)
func (*StationNoteRepository) QueryStationNoteByID ¶
func (r *StationNoteRepository) QueryStationNoteByID(ctx context.Context, id int32) (*data.StationNote, error)
func (*StationNoteRepository) UpdateStationNoteByID ¶
func (r *StationNoteRepository) UpdateStationNoteByID(ctx context.Context, note *data.StationNote) (*data.StationNote, error)
type StationRepository ¶
type StationRepository struct {
// contains filtered or unexported fields
}
func NewStationRepository ¶
func NewStationRepository(db *sqlxcache.DB) (rr *StationRepository)
func (*StationRepository) AddStation ¶
func (*StationRepository) AssociateStations ¶
func (r *StationRepository) AssociateStations(ctx context.Context, stationID, associatedStationID, priority int32) (err error)
func (*StationRepository) ClearAssociatedStations ¶
func (r *StationRepository) ClearAssociatedStations(ctx context.Context, stationID int32) error
func (*StationRepository) Delete ¶
func (sr *StationRepository) Delete(ctx context.Context, stationID int32) error
func (*StationRepository) FindOrCreateStationModel ¶
func (r *StationRepository) FindOrCreateStationModel(ctx context.Context, ttnSchemaID int32, name string) (model *data.StationModel, err error)
func (*StationRepository) QueryAllStationsByModelID ¶
func (*StationRepository) QueryAssociatedStations ¶
func (r *StationRepository) QueryAssociatedStations(ctx context.Context, stationIDs []int32) (map[int32][]*AssociatedStation, error)
func (*StationRepository) QueryEssentialStations ¶
func (sr *StationRepository) QueryEssentialStations(ctx context.Context, qp *EssentialQueryParams) (*QueriedEssential, error)
func (*StationRepository) QueryNearbyProjectStations ¶
func (r *StationRepository) QueryNearbyProjectStations(ctx context.Context, projectID int32, location *data.Location) ([]*NearbyStation, error)
func (*StationRepository) QueryStationByArbitraryDeviceID ¶
func (*StationRepository) QueryStationByDeviceID ¶
func (*StationRepository) QueryStationByID ¶
func (*StationRepository) QueryStationByPhotoID ¶
func (*StationRepository) QueryStationConfigurationByMetaID ¶
func (r *StationRepository) QueryStationConfigurationByMetaID(ctx context.Context, metaRecordID int64) (*data.StationConfiguration, error)
func (*StationRepository) QueryStationFull ¶
func (r *StationRepository) QueryStationFull(ctx context.Context, id int32) (*data.StationFull, error)
func (*StationRepository) QueryStationFullByOwnerID ¶
func (r *StationRepository) QueryStationFullByOwnerID(ctx context.Context, id int32) ([]*data.StationFull, error)
func (*StationRepository) QueryStationFullByProjectID ¶
func (r *StationRepository) QueryStationFullByProjectID(ctx context.Context, id int32) ([]*data.StationFull, error)
func (*StationRepository) QueryStationModuleByID ¶
func (r *StationRepository) QueryStationModuleByID(ctx context.Context, id int32) (module *data.StationModule, err error)
func (*StationRepository) QueryStationModulesByConfigurationID ¶
func (r *StationRepository) QueryStationModulesByConfigurationID(ctx context.Context, configurationID int64) ([]*data.StationModule, error)
func (*StationRepository) QueryStationModulesByHardwareID ¶
func (r *StationRepository) QueryStationModulesByHardwareID(ctx context.Context, hardwareID []byte) ([]*data.StationModule, error)
func (*StationRepository) QueryStationModulesByMetaID ¶
func (r *StationRepository) QueryStationModulesByMetaID(ctx context.Context, metaRecordID int64) ([]*data.StationModule, error)
func (*StationRepository) QueryStationProjectIds ¶
func (*StationRepository) QueryStationSensors ¶
func (sr *StationRepository) QueryStationSensors(ctx context.Context, stations []int32) (map[int32][]*StationSensor, error)
func (*StationRepository) QueryStationsByDeviceID ¶
func (*StationRepository) QueryVisibleConfiguration ¶
func (r *StationRepository) QueryVisibleConfiguration(ctx context.Context, stationID int32) (*data.StationConfiguration, *data.Provision, error)
func (*StationRepository) Search ¶
func (sr *StationRepository) Search(ctx context.Context, query string) (*QueriedEssential, error)
func (*StationRepository) TryQueryStationByDeviceID ¶
func (*StationRepository) UpdateOwner ¶
func (*StationRepository) UpdatePhoto ¶
func (*StationRepository) UpdateStation ¶
func (*StationRepository) UpdateStationModelFromStatus ¶
func (*StationRepository) UpdateStationModule ¶
func (r *StationRepository) UpdateStationModule(ctx context.Context, module *data.StationModule) (*data.StationModule, error)
func (*StationRepository) UpsertConfiguration ¶
func (r *StationRepository) UpsertConfiguration(ctx context.Context, configuration *data.StationConfiguration) (*data.StationConfiguration, error)
func (*StationRepository) UpsertModuleSensor ¶
func (r *StationRepository) UpsertModuleSensor(ctx context.Context, sensor *data.ModuleSensor) (*data.ModuleSensor, error)
func (*StationRepository) UpsertStationModule ¶
func (r *StationRepository) UpsertStationModule(ctx context.Context, module *data.StationModule) (*data.StationModule, error)
func (*StationRepository) UpsertVisibleConfiguration ¶
type StationSensor ¶
type StationSensor struct { StationID int32 `json:"stationId"` StationName string `json:"stationName"` StationLocation *data.Location `json:"stationLocation"` ModulePrimaryID *int64 `json:"modulePrimaryId"` ModuleID *string `json:"moduleId"` ModuleKey *string `json:"moduleKey"` SensorID *int64 `json:"sensorId"` SensorKey *string `json:"sensorKey"` SensorReadAt *time.Time `json:"sensorReadAt"` ModuleOrder int32 `json:"moduleOrder"` Order int32 `json:"order"` }
type StationSensorByOrder ¶
type StationSensorByOrder []*StationSensor
func (StationSensorByOrder) Len ¶
func (a StationSensorByOrder) Len() int
func (StationSensorByOrder) Less ¶
func (a StationSensorByOrder) Less(i, j int) bool
func (StationSensorByOrder) Swap ¶
func (a StationSensorByOrder) Swap(i, j int)
type StationSensorRow ¶
type StationSensorRow struct { StationID int32 `db:"station_id" json:"stationId"` StationName string `db:"station_name" json:"stationName"` StationLocation *data.Location `db:"station_location" json:"stationLocation"` ModulePrimaryID *int64 `db:"module_id" json:"modulePrimaryId"` ModuleID *string `db:"module_hardware_id" json:"moduleId"` ModuleKey *string `db:"module_key" json:"moduleKey"` SensorID *int64 `db:"sensor_id" json:"sensorId"` SensorKey *string `db:"sensor_key" json:"sensorKey"` SensorReadAt *time.Time `db:"sensor_read_at" json:"sensorReadAt"` }
type UserRepository ¶
type UserRepository struct {
// contains filtered or unexported fields
}
func NewUserRepository ¶
func NewUserRepository(db *sqlxcache.DB) (r *UserRepository)
func (*UserRepository) Delete ¶
func (r *UserRepository) Delete(outerCtx context.Context, id int32) (err error)
func (*UserRepository) NewRecoveryToken ¶
func (r *UserRepository) NewRecoveryToken(ctx context.Context, user *data.User, duration time.Duration) (*data.RecoveryToken, error)
func (*UserRepository) QueryAdminByEmail ¶
func (*UserRepository) QueryByEmail ¶
func (*UserRepository) QueryMentionables ¶
type VersionMeta ¶
type VersionMeta struct { ID int64 `json:"id"` Station *DataMetaStation `json:"station"` }
type VizConfig ¶
type VizConfig struct { Name string `json:"name"` Disabled bool `json:"disabled"` MinimumGap int32 `json:"minimumGap"` Thresholds *VizThresholds `json:"thresholds"` }
type VizThreshold ¶
type VizThreshold struct { Label map[string]string `json:"label"` KeyLabel map[string]string `json:"keyLabel"` MapKeyLabel map[string]string `json:"mapKeyLabel"` PlainLabel map[string]string `json:"plainLabel"` Value float64 `json:"value"` Color string `json:"color"` Hidden bool `json:"hidden"` Start float64 `json:"start"` }
type VizThresholds ¶
type VizThresholds struct { Label map[string]string `json:"label"` Levels []*VizThreshold `json:"levels"` }
Source Files ¶
- activity_repository.go
- attributes_repository.go
- bookmark_repository.go
- discussion_repository.go
- event_repository.go
- export_repository.go
- filtering.go
- ingestion_repository.go
- interestingness_repository.go
- layout_repository.go
- logging.go
- media_repository.go
- meta.go
- model.go
- module_meta.go
- notifications_repository.go
- projects_repository.go
- provision_repository.go
- record_repository.go
- sensors_repository.go
- station_note_repository.go
- station_repository.go
- user_repository.go
Click to show internal directories.
Click to hide internal directories.