db

package
v0.0.0-...-c144a73 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectDB

func ConnectDB() (*sql.DB, string, error)

ConnectDB opens a connection to a SQLite database. It returns a pointer to the sql.DB object and an error if any occurs.

func FileExists

func FileExists(filePath string) bool

FileExists This function checks if a file exists, if it does returns true. Otherwise it returns false.

func IsSetup

func IsSetup(db *sql.DB) bool

IsSetup checks if the database has been set up.

  1. Returns false if the tasks table does not exist
  2. Returns true if the tasks table exists

func ResetDB

func ResetDB(db *sql.DB) error

ResetDB drops all tables and recreates them.

func SetupDB

func SetupDB(db *sql.DB) error

SetupDB Setup the Initial DB Schema

  1. Creates the areas and tasks tables if they do not exist
  2. Returns an error if any occurs
  3. Uses transactions for safety
  4. Uses prepared statements for better performance

Types

This section is empty.

Jump to

Keyboard shortcuts

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