model

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package model sets up the database and defines functions that interact with the db

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddSite

func AddSite()

Adds a new site's details to the db

func DeleteRecord

func DeleteRecord(value string, recordType RecordType)

Delete records associated with a site

func GetInput

func GetInput(prompt string) string

Get input from the user

func SetupDB

func SetupDB(dbLoc string) error

SetupDb creates a connection to the db and initializes the table and columns Returns a possible error

func UpdateRecord added in v0.9.0

func UpdateRecord(recordType RecordType)

Updates the contents of a specified site

Types

type RecordType

type RecordType int
const (
	Username RecordType = iota
	SiteName
)

type Site

type Site struct {
	ID       int32
	Name     string
	UserName string
	Password string
}

Site defines the structure of the db

func ListAll

func ListAll() []Site

Returns all the records in the db

func SearchRecords

func SearchRecords(value string, searchBy RecordType) ([]Site, error)

Returns records matching the users prompt(the site name)

func UpdateRec added in v0.9.0

func UpdateRec(site Site) Site

Jump to

Keyboard shortcuts

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