Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetRecentSensorMessages ¶
GetRecentSensorMessages returns the most recent sensor messages (1 minute) of a client
func InsertSensorMessage ¶
InsertSensorMessage inserts a sensor message into the database
func UpsertClient ¶
func UpsertClient(db *DB, remoteAddr string) *entities.ClientEntity
UpsertClient inserts a new client into the database if it doesn't exist, otherwise updates the last seen time
Types ¶
type DB ¶
func Connect ¶
func Connect(env *database_models.PostgresEnv) *DB
Connect creates a new database connection using exponential backoff when failing to connect
func (*DB) InsertClient ¶
func (db *DB) InsertClient(ipAddr string) (*entities.ClientEntity, error)
InsertClient inserts a new client into the database
type DBClient ¶
type DBClient struct {
// contains filtered or unexported fields
}
DBClient manages the lifecycle of database operations
func (*DBClient) Init ¶
func (dbc *DBClient) Init(config *serverConfig.ServerConfig)
Init initializes the database client
Click to show internal directories.
Click to hide internal directories.