dbo

package
v0.0.65 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2024 License: GPL-3.0 Imports: 11 Imported by: 2

Documentation

Index

Constants

View Source
const (
	TableIncidents     = "Incidents"
	TableNotifications = "Notifications"
	TableResources     = "Resources"
	TableSystemEvents  = "SystemEvents"
)
View Source
const (
	DbPsid_InsertNewNotification            = 0
	DbPsid_GetNotificationById              = 1
	DbPsid_MarkNotificationAsRead           = 2
	DbPsid_DeleteNotificationById           = 3
	DbPsid_SaveIncident                     = 4
	DbPsid_SaveIncidentWithoutUserIPA       = 5
	DbPsid_GetAllNotificationsByUserId      = 6
	DbPsid_GetUnreadNotificationsByUserId   = 7
	DbPsid_CountUnreadNotificationsByUserId = 8
	DbPsid_ClearNotifications               = 9
	DbPsid_GetNotificationsByUserIdOnPage   = 10
	DbPsid_CountAllNotificationsByUserId    = 11
	DbPsid_SaveSystemEvent                  = 12
	DbPsid_GetSystemEventById               = 13
	DbPsid_AddResource                      = 14
	DbPsid_GetResourceById                  = 15
	DbPsid_DeleteResourceById               = 16
	DbPsid_ListAllResourceIdsOnPage         = 17
	DbPsid_CountAllResources                = 18
)

Indices of prepared statements.

Variables

This section is empty.

Functions

This section is empty.

Types

type DatabaseObject

type DatabaseObject struct {
	cdbo.DatabaseObject
	// contains filtered or unexported fields
}

func NewDatabaseObject

func NewDatabaseObject(settings ns.DbSettings) (dbo *DatabaseObject)

func (*DatabaseObject) AddResource added in v0.0.61

func (dbo *DatabaseObject) AddResource(r *cm.Resource) (lastInsertedId cmb.Id, err error)

func (*DatabaseObject) CountAllNotificationsByUserId added in v0.0.50

func (dbo *DatabaseObject) CountAllNotificationsByUserId(userId cmb.Id) (n cmb.Count, err error)

func (*DatabaseObject) CountAllResources added in v0.0.61

func (dbo *DatabaseObject) CountAllResources() (n cmb.Count, err error)

func (*DatabaseObject) CountUnreadNotificationsByUserId

func (dbo *DatabaseObject) CountUnreadNotificationsByUserId(userId cmb.Id) (n cmb.Count, err error)

func (*DatabaseObject) DeleteNotificationById

func (dbo *DatabaseObject) DeleteNotificationById(notificationId cmb.Id) (err error)

func (*DatabaseObject) DeleteResourceById added in v0.0.61

func (dbo *DatabaseObject) DeleteResourceById(resourceId cmb.Id) (err error)

func (*DatabaseObject) GetAllNotificationsByUserId

func (dbo *DatabaseObject) GetAllNotificationsByUserId(userId cmb.Id) (notifications []nm.Notification, err error)

func (*DatabaseObject) GetNotificationById

func (dbo *DatabaseObject) GetNotificationById(notificationId cmb.Id) (notification *nm.Notification, err error)

func (*DatabaseObject) GetNotificationsByUserIdOnPage added in v0.0.50

func (dbo *DatabaseObject) GetNotificationsByUserIdOnPage(userId cmb.Id, pageNumber cmb.Count, pageSize cmb.Count) (notifications []nm.Notification, err error)

func (*DatabaseObject) GetPreparedStatementByIndex

func (dbo *DatabaseObject) GetPreparedStatementByIndex(i int) (ps *sql.Stmt)

func (*DatabaseObject) GetResourceById added in v0.0.61

func (dbo *DatabaseObject) GetResourceById(resourceId cmb.Id) (r *cm.Resource, err error)

func (*DatabaseObject) GetResourceIdsOnPage added in v0.0.61

func (dbo *DatabaseObject) GetResourceIdsOnPage(pageNumber cmb.Count, pageSize cmb.Count) (resourceIds []cmb.Id, err error)

func (*DatabaseObject) GetSystemEventById added in v0.0.59

func (dbo *DatabaseObject) GetSystemEventById(systemEventId cmb.Id) (se *cm.SystemEvent, err error)

func (*DatabaseObject) GetUnreadNotifications

func (dbo *DatabaseObject) GetUnreadNotifications(userId cmb.Id) (notifications []nm.Notification, err error)

func (*DatabaseObject) Init

func (dbo *DatabaseObject) Init() (err error)

Init connects to the database, initialises the tables and prepares SQL statements.

func (*DatabaseObject) InsertNewNotification

func (dbo *DatabaseObject) InsertNewNotification(userId cmb.Id, text cmb.Text) (lastInsertedId cmb.Id, err error)

func (*DatabaseObject) MarkNotificationAsRead

func (dbo *DatabaseObject) MarkNotificationAsRead(notificationId cmb.Id, userId cmb.Id) (err error)

func (*DatabaseObject) SaveIncident

func (dbo *DatabaseObject) SaveIncident(module enum.EnumValue, incidentType cm.IncidentType, email cm.Email, userIPAB net.IP) (err error)

func (*DatabaseObject) SaveIncidentWithoutUserIPA

func (dbo *DatabaseObject) SaveIncidentWithoutUserIPA(module enum.EnumValue, incidentType cm.IncidentType, email cm.Email) (err error)

func (*DatabaseObject) SaveSystemEvent added in v0.0.59

func (dbo *DatabaseObject) SaveSystemEvent(se cm.SystemEvent) (err error)

type TableNames

type TableNames struct {
	Incidents     string
	Notifications string
	Resources     string
	SystemEvents  string
}

Jump to

Keyboard shortcuts

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