db

package
v0.0.0-...-9e1cc8c Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewNotificationRepo

func NewNotificationRepo(db sql.Db) *notificationRepo

Types

type Notification

type Notification struct {
	Id          uuid.UUID        `gorm:"primaryKey;type:uuid"`
	NodeId      string           `gorm:"type:string;size:23;expression:lower(node_id);" json:"nodeId"`
	NodeType    string           `json:"nodeType"`
	Severity    SeverityType     `gorm:"type:string;expression:lower(severity)" json:"severity"`
	Type        NotificationType `gorm:"type:string;expression:lower(notification_type)" json:"notificationType"`
	ServiceName string           `json:"serviceName"`
	Status      uint32           `json:"status"`
	Time        uint32           `json:"time"`
	Description string           `json:"description"`
	Details     datatypes.JSON   `json:"details"`
	CreatedAt   time.Time
	UpdatedAt   time.Time
	DeletedAt   gorm.DeletedAt `gorm:"index"`
}

type NotificationRepo

type NotificationRepo interface {
	Add(n *Notification) error
	Get(id uuid.UUID) (*Notification, error)
	List(nodeId, serviceName, nType string, count uint32, sort bool) ([]Notification, error)
	Delete(id uuid.UUID) error
	Purge(nodeId, serviceName, nType string) ([]Notification, error)
}

type NotificationType

type NotificationType string
const (
	Alert NotificationType = "alert"
	Event NotificationType = "event"
)

func GetNotificationType

func GetNotificationType(s string) (*NotificationType, error)

func (NotificationType) String

func (n NotificationType) String() string

type SeverityType

type SeverityType string
const (
	Fatal    SeverityType = "fatal"
	Critical SeverityType = "critical"
	High     SeverityType = "high"
	Medium   SeverityType = "medium"
	Low      SeverityType = "low"
	Clean    SeverityType = "clean"
	Log      SeverityType = "log"
	Warning  SeverityType = "warning"
	Debug    SeverityType = "debug"
	Trace    SeverityType = "trace"
)

func GetSeverityType

func GetSeverityType(s string) (*SeverityType, error)

func (SeverityType) String

func (n SeverityType) String() string

Jump to

Keyboard shortcuts

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