postgres

package
v0.40.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

README

Consumers - Alarms - DB Schema

CREATE TABLE IF NOT EXISTS alarms (
    id          UUID PRIMARY KEY,
    thing_id    UUID NOT NULL,
    group_id    UUID NOT NULL,
    rule_id     UUID,
    script_id   UUID,
    subtopic    VARCHAR(254),
    protocol    TEXT,
    rule        JSONB,
    level       SMALLINT NOT NULL DEFAULT 1,
    status      VARCHAR(10) NOT NULL DEFAULT 'active' CHECK (status IN ('active', 'noted', 'cleared')),
    created     BIGINT
)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect

func Connect(cfg Config) (*sqlx.DB, error)

Connect creates a connection to the PostgreSQL instance and applies any unapplied database migrations. A non-nil error is returned to indicate failure.

func NewAlarmRepository

func NewAlarmRepository(db dbutil.Database) alarms.AlarmRepository

Types

type Config

type Config struct {
	Host        string
	Port        string
	User        string
	Pass        string
	Name        string
	SSLMode     string
	SSLCert     string
	SSLKey      string
	SSLRootCert string
}

Config defines the options that are used when connecting to a PostgreSQL instance

Jump to

Keyboard shortcuts

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