database

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Amend

func Amend(args []string, dayOrDate string, month string, year string)

Amend a shift in the database.

func Delete

func Delete(dayOrDate string, month string, year string)

Delete the selected shift from the database.

func ExecuteQuery

func ExecuteQuery(database *sql.DB, query string)

Execute a query within the SQLite instance.

func FormatMessage

func FormatMessage(message *string)

Format the message if there are quotes. Single quotes need to be doubled up (ie. `”`) when inserting into a SQL database.

func List

func List(dayOrDate string, month string, subCommand string, year string)

Pull and list records from the database.

func OpenDatabase

func OpenDatabase() (*sql.DB, error)

Open the `shifts.db` SQLite instance.

func StructureDB

func StructureDB()

Create the .db binary and relational tables within it.

Types

type Deserialize

type Deserialize struct {
	ShiftID         int
	Date            string
	Day             string
	ClockIn         string
	ClockInMessage  string
	ClockOut        string
	ClockOutMessage string
	ShiftDuration   string
	Month           string
}

Struct used to store deserialized data from querying the SQLite instance.

func DeserializeRows

func DeserializeRows(database *sql.DB, query string) []Deserialize

Run a SELECT SQL on the SQLite instance and return a slice of structs containing deserialized data.

Jump to

Keyboard shortcuts

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