* feat(backend): moved sql requests related to sessions table to one place * feat(backend): refactoring in db.Saver handler * feat(backend): hude refactoring in db/postgres module * fix(backend): workable feature flags * fix(backend): workable integrations * fix(backend): workable sessions and projects modules * fix(backend): added missed projects module to sessions * feat(backend): renaming * feat(backend): moved session struct to sessions module and split methods into interface, cache and storage levels * feat(backend): moved project struct to projects module * feat(backend): added projects model * feat(backend): implemented new in memory cache for sessions and projects * feat(backend): implemented new cache in projects * feat(backend): there are 2 methods in cache module now: Get() and GetAndRefresh() * feat(backend): added cache update operations * fix(backend): fixed import cycle * fix(backend): fixed panic in db message handler * fix(backend): fixed panic in projects module * fix(backend): fixed panic in sessions.GetDuration * feat(backend): added direct call to get session duration if session is already in cache * feat(backend): used pg pool everywhere except db service * fix(backend): added missing part after rebase * fix(backend): removed old sessions file * feat(backend): added refactored redis client with produce/consume options * feat(backend): added cache layer for projects * fix(backend): added missing redis config * fix(backend): added missing method for producer * feat(backend): cache integration for sessions * feat(backend): temporary method to get session directly from db * feat(backend): adapt EE version of message handler * fix(backend): fixed issue in fts realisation * fix(backend): added redis cache to sessions module * fix(backend): set 0 duration or hesitation time for inputs without focus event * feat(backend): added cache for session updates and failover mechanism for batch.Insert() operation * feat(backend): debug log * feat(backend): more debug log * feat(backend): removed debug log * fix(backend): fixed an issue of tracking input events with empty label * fix(backend): disabled debug log in projects cache * fix(backend): renamed session updater * fix(backend): fixed closed pool issue in DB service * fix(backend): fixed dead lock in db Stop() method * fix(backend): fixed panic in heuristics service * feat(backend): enabled redis cache in projects * feat(backend): clear cache on each update operation * feat(backend): fully integrated cache layer with auto switch * feat(backend): small refactoring in session updates * fix(backend): fixed wrong events counter issue * feat(backend): enabled full cache support in ender and http services * fix(backend/ee): added missed import * feat(backend): added second cache layer for db to speed up the service * feat(backend): disable redis cache * feat(backend): moved redis cache to ee
60 lines
1.3 KiB
Go
60 lines
1.3 KiB
Go
package projects
|
|
|
|
import "log"
|
|
|
|
type Project struct {
|
|
ProjectID uint32
|
|
ProjectKey string
|
|
MaxSessionDuration int64
|
|
SampleRate byte
|
|
SaveRequestPayloads bool
|
|
BeaconSize int64
|
|
Metadata1 *string
|
|
Metadata2 *string
|
|
Metadata3 *string
|
|
Metadata4 *string
|
|
Metadata5 *string
|
|
Metadata6 *string
|
|
Metadata7 *string
|
|
Metadata8 *string
|
|
Metadata9 *string
|
|
Metadata10 *string
|
|
}
|
|
|
|
func (p *Project) GetMetadataNo(key string) uint {
|
|
if p == nil {
|
|
log.Printf("GetMetadataNo: Project is nil")
|
|
return 0
|
|
}
|
|
if p.Metadata1 != nil && *(p.Metadata1) == key {
|
|
return 1
|
|
}
|
|
if p.Metadata2 != nil && *(p.Metadata2) == key {
|
|
return 2
|
|
}
|
|
if p.Metadata3 != nil && *(p.Metadata3) == key {
|
|
return 3
|
|
}
|
|
if p.Metadata4 != nil && *(p.Metadata4) == key {
|
|
return 4
|
|
}
|
|
if p.Metadata5 != nil && *(p.Metadata5) == key {
|
|
return 5
|
|
}
|
|
if p.Metadata6 != nil && *(p.Metadata6) == key {
|
|
return 6
|
|
}
|
|
if p.Metadata7 != nil && *(p.Metadata7) == key {
|
|
return 7
|
|
}
|
|
if p.Metadata8 != nil && *(p.Metadata8) == key {
|
|
return 8
|
|
}
|
|
if p.Metadata9 != nil && *(p.Metadata9) == key {
|
|
return 9
|
|
}
|
|
if p.Metadata10 != nil && *(p.Metadata10) == key {
|
|
return 10
|
|
}
|
|
return 0
|
|
}
|