pkg

package
v0.0.0-...-29203d2 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

* File: user Description: Implements features for an unique user including passwords @author Bryan Conn @date 10/7/2018

Index

Constants

View Source
const (
	DEBUG   LogLevel = 0
	SQL              = 1
	INFO             = 2
	WARNING          = 3
	ERROR            = 4
	FATAL            = 5
)
View Source
const (
	UE   = 0 // Empty Username
	US   = 1 // Username contains spaces
	PE   = 2 // Empty Password
	PS   = 3 // Password contains spaces
	PIV  = 4 // Password too long or short
	TN   = 5 // Taken Name
	GOOD = 6 // No Issues
)

* Declares constants that determine the validity of an entered password

Variables

View Source
var GcLogDir string
View Source
var GpcFile *os.File
View Source
var Initial bool
View Source
var McConnStr string

Database password needs to be changed when released

View Source
var McDatabase string
View Source
var McDb *sql.DB
View Source
var McHost string
View Source
var McPassword string
View Source
var McPort string
View Source
var McRouter *mux.Router
View Source
var McUsername string

Functions

func Backup

func Backup(acBackupPath string)

func CheckPassword

func CheckPassword(asUser User, acPassword string) bool

* Function: CheckPassword Description: Determines if the password matches the users password @param asUser The user that is being checked @param acPassword The password that was entered @return If the password matches

func Issue

func Issue(err error, acPath string)

* Function: Issue Description: Checks for an error and reports it @param err The error

func Log

func Log(acLog string, anLogLevel LogLevel, acPath string)

func MakeUser

func MakeUser(acUsername string, acPassword string) (int, string)

* Function: MakeUser Description: Creates a new user and adds them to the database @param acUsername The username of the new user @param acPassword The password used for the user @return The validity of the new user

func ParseDateStrings

func ParseDateStrings(acTime time.Time) (string, string, string)

Types

type Audit

type Audit struct {
	McNdc           string
	McPharmacist    string
	McYear          string
	McMonth         string
	McDay           string
	MnAuditQuantity float64
}

* Audit struct contains an audited quantity, the pharmacist who performed the audit, the date the audit was performed and the ndc of the audited drug

func MakeAudit

func MakeAudit(acNdc string, acPharmacist string, anAuditQuantity float64, acYear string, acMonth string,
	acDay string) Audit

* Function: MakeAudit Description: Makes an audit struct @param anAuditQuantity The quantity recorded in the audit @param acPharmacist The initials of the pharmacist who performed the audit @param acDate The the audit was performed @param acNdc The ndc of the drug @return An Audit object

type Date

type Date struct {
	MnDay   int
	McMonth time.Month
	MnYear  int
}

* Date struct holds a month day and year

func MakeDate

func MakeDate(acMonth time.Month, acDay int, acYear int) Date

* Function: MakeDate Description: Makes a drug struct with the month, day, year @param acMonth The month @param acDay The day @param acYear The year @return A Date object

type Drug

type Drug struct {
	McNdc      string
	MrQuantity float64
	McName     string
	McDate     time.Time
	McForm     string
	McSize     string
	McItemNum  string
}

* Drug struct contains an id name, ndc code, and quantity

type DrugDB

type DrugDB struct {
	Name     string
	Ndc      string
	Size     string
	Form     string
	ItemNum  string
	Month    string
	Day      string
	Year     string
	Quantity float64
}

* Drug struct contains an id name, ndc code, and quantity

type LogLevel

type LogLevel int
var GbLogLevel LogLevel

type NewDrug

type NewDrug struct {
	Error string
	Ndc   string
	Id    int
}

* Struct containing the error type, ndc, and an unique id.

type Order

type Order struct {
	AcPharmacist       string
	AcMonth            string
	AcDay              int
	AcYear             int
	AcScript, AcType   string
	ArQty, ArActualQty float64
	AcNdc              string
	AnId               int64
}

* Order struct contains the pharmacist on the order, the script/type of the order the quantity and the date of the order

func MakeOrder

func MakeOrder(acNdc string, acPharmacist string, acScript string, acType string, arQty float64, arActualQty float64,
	acYear string, acMonth string, acDay string, anId int64) Order

* Function: MakeOrder Description: Creates an order using an audit, prescription, or purchase @param acPharmacist The pharmacist on the order @param acScript The script/type of the order @param anQty The quantity of the order @param anQty The real quantity of the order drug @param acDate The date of the order @param acType The type of the order @return An Order Object

type Prescription

type Prescription struct {
	McNdc                  string
	McPharmacist, McScript string
	McYear                 string
	McMonth                string
	McDay                  string
	MnOrderQuantity        float64
	MrActualQty            float64
}

* Prescription struct contains the ndc of drug of the order, the pharmacist that filled the order, the script id, the quantity of the order, the date the order was filled

func MakePrescription

func MakePrescription(acNdc string, asPharmacist string, acScript string, anQty float64, acYear string, acMonth string,
	acDay string, arActualQty float64) Prescription

* Function: MakePrescription Description: Makes a Prescription struct @param acNdc The ndc of the drug being ordered @param anQty The quantity of the order @param asPharmacist The initials of the pharmacist @param acScript The script id @param acDate The date of the order @return A prescription object

type Purchase

type Purchase struct {
	MnNdc        string
	McPharmacist string
	McInvoice    string
	McYear       string
	McMonth      string
	McDay        string
	MrQty        float64
	MrActualQty  float64
}

* Purchase struct contains the ndc of a drug, purchase date, and purchased quantity, and the pharmacist that counted the drug

func MakePurchase

func MakePurchase(acNdc string, acPharmacist string, acInvoice string, acYear string, acMonth string, acDay string,
	anQty float64, anActualQty float64) Purchase

* Function: MakePurchase Description: Makes a Purchase struct @param acNdc The ndc of the drug that was bought @param acDate The date the purchase was added to the supply @param anQty The quantity bought @param acPharmacist The pharmacist that counted the drug @return A Purchase object

type User

type User struct {
	UserName string
	PassVal  string
}

* User struct contains a username and a password value

func FindUser

func FindUser(acName string) User

* Function: FindUser Description: Looks for user in the database @param acName The name of the user to be found @return The user if its found, if not a blank user

func (User) GetUserName

func (asUser User) GetUserName() string

* Function: GetUserName Description: Returns the username of the user @return The name of the user

Jump to

Keyboard shortcuts

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