mysql

package
v0.0.0-...-041f5a1 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MySQL

type MySQL struct {
	Host     string
	Port     int
	User     string
	Password string
	Database string
}

MySQL requirements

func (*MySQL) AddCheck

func (m *MySQL) AddCheck(check gogios.Check, output string) error

AddCheck makes sure an entry exists for the check and then adds to its history

func (*MySQL) AddUser

func (m *MySQL) AddUser(user gogios.User) error

AddUser inserts a new user into the database

func (*MySQL) DeleteCheck

func (m *MySQL) DeleteCheck(check gogios.Check, field string) error

DeleteCheck will remove a row from the check table based on the ID

func (*MySQL) DeleteUser

func (m *MySQL) DeleteUser(user gogios.User) error

DeleteUser sets the DeletedAt value of the user and blanks their password

func (*MySQL) Description

func (m *MySQL) Description() string

Description returns a brief explanation of the database

func (*MySQL) GetAllChecks

func (m *MySQL) GetAllChecks() ([]gogios.Check, error)

GetAllChecks returns all the rows in the check table

func (*MySQL) GetCheck

func (m *MySQL) GetCheck(searchField, searchType string) (gogios.Check, error)

GetCheck returns a single row. Searches using field (title or id) and returns the last record that matches

func (*MySQL) GetCheckHistory

func (m *MySQL) GetCheckHistory(check gogios.Check, amount int) ([]gogios.CheckHistory, error)

GetCheckHistory returns $amount of rows of history for a check

func (*MySQL) GetUser

func (m *MySQL) GetUser(user string) (*gogios.User, error)

GetUser looks up a user by username and returns their struct

func (*MySQL) Init

func (m *MySQL) Init() error

Init creates the database file and tables

func (*MySQL) SampleConfig

func (m *MySQL) SampleConfig() string

SampleConfig returns the default config for MySQL

func (*MySQL) SubConfig

func (m *MySQL) SubConfig() string

SubConfig returns the default config ready for variable substitution

Jump to

Keyboard shortcuts

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