db

package
v0.0.0-...-77c539c Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init() error

Init is used to initialize the SQL Database

Types

type Database

type Database struct {
	// contains filtered or unexported fields
}

Database is a wrapper around the SQL database to allow addition of methods

func New

func New() *Database

New returns an instance of Database Use this when you don't want to clear the DB

func (*Database) AddEvents

func (DB *Database) AddEvents(events *ctftime.Events) error

AddEvents adds a slice of Events in the database

func (*Database) Close

func (DB *Database) Close()

Close closes the connetion to the database, can call this with defer in main

func (*Database) DeleteEventByID

func (DB *Database) DeleteEventByID(eventID int) error

DeleteEventByID deletes the event with ID eventID

func (*Database) GetEvents

func (DB *Database) GetEvents() (ctftime.Events, error)

GetEvents returns Events from the database

func (*Database) GetEventsByStatus

func (DB *Database) GetEventsByStatus(status utils.Status) (ctftime.Events, error)

GetEventsByStatus returns events depending upon the Status attribute

func (*Database) GetRegisteredChannels

func (DB *Database) GetRegisteredChannels() ([]string, error)

GetRegisteredChannels returns all ChannelIDs from the notify table

func (*Database) ModifyEventStatus

func (DB *Database) ModifyEventStatus(eventID int, status utils.Status) error

ModifyEventStatus modifies the status of the event identified by the eventID

func (*Database) Ping

func (DB *Database) Ping()

Ping allows you to ping the database and check if connection is possible

func (*Database) RegisterForNotifs

func (DB *Database) RegisterForNotifs(ChannelID string) error

RegisterForNotifs adds a Channel to the notify table

Jump to

Keyboard shortcuts

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