Documentation ¶
Index ¶
- Variables
- func AssignJobLabel(jobId int64, labelId int64) (*int64, error)
- func ConnectDatabase(filename string) (*sql.DB, error)
- func CreateAlert(newAlert models.NewAlert) (*int64, error)
- func CreateDatabase(filename string, sqlString string) error
- func CreateJob(newJob models.NewJob) (*int64, error)
- func CreateLabel(newLabel models.NewLabel) (*int64, error)
- func CreateTask(newTask models.NewTask, jobId int64) (*int64, error)
- func CreateUser(newUser models.NewUser, password *[]byte) (*int64, error)
- func CreateVehicle(newVehicle models.NewVehicle) (*int64, error)
- func DeleteAlert(alertId int64, userId *int64) error
- func DeleteJob(jobId int64, userId *int64) error
- func DeleteLabel(labelId int64, userId *int64) error
- func DeleteTask(jobId int64, taskId *int64) error
- func DeleteUser(username string) error
- func DeleteVehicle(vehicleId int64, userId *int64) error
- func EditAlert(editedAlert models.Alert) error
- func EditJob(editedJob models.Job) error
- func EditLabel(editedLabel models.Label) error
- func EditTask(editedTask models.Task, jobId int64) error
- func EditUser(editedUser models.User) error
- func EditVehicle(editedVehicle models.Vehicle) error
- func GetAlert(alertId int64) (*models.Alert, error)
- func GetAuthInfoByUsername(username string) (*int64, *string, *int, *[]byte, error)
- func GetJob(jobId int64) (*models.Job, error)
- func GetLabel(labelId int64) (*models.Label, error)
- func GetTask(jobId int64, taskId int64) (*models.Task, error)
- func GetUserById(userId int64) (*models.User, error)
- func GetUserByUsername(username string) (*models.User, error)
- func GetVehicle(vehicleId int64) (*models.Vehicle, error)
- func LabelProcessor(ids *string, names *string, colors *string, createdTimes *string, ...) ([]models.Label, error)
- func ListAlerts(userId *string, vehicleId *string, jobId *string, taskId *string, ...) ([]*models.Alert, error)
- func ListJobs(userId *string, vehicleId *string, isTemplate *string, isComplete *string, ...) ([]*models.Job, error)
- func ListLabels(userId *string, jobId *string, searchStr *string, sort *string) ([]*models.Label, error)
- func ListTasks(jobId int64, isComplete *string, searchStr *string, sort *string) ([]*models.Task, error)
- func ListUsers(jobId *string, vehicleId *string, isAdmin *string, searchStr *string, ...) ([]*models.User, error)
- func ListVehicles(userId *string, jobId *string, searchStr *string, sort *string) ([]*models.Vehicle, error)
- func QueryBuilder(query string, joins *[]string, wheres *[]string, likes *[]Like, ...) string
- func UnassignJobLabel(jobId int64, labelId int64) error
- func UpdatePassword(username string, password *[]byte) error
- func UpdateTaskStatus(jobId int64, taskId int64, status int) error
- func UpdatedAlertStatus(alertId int64, userId int64, status int) error
- type Like
Constants ¶
This section is empty.
Variables ¶
var DB *sql.DB
Functions ¶
func AssignJobLabel ¶
AssignJobLabel Takes job id and task id, creates job_label in db, returns id
func ConnectDatabase ¶
ConnectDatabase Use sqlite pkg to establish a connection
func CreateAlert ¶
CreateAlert Takes newAlert, creates in db, returns id
func CreateLabel ¶
CreateLabel Takes newLabel, creates in db, returns id
func CreateTask ¶
CreateTask Takes newTask, creates in db, returns id
func CreateUser ¶
CreateUser Take NewUser and hashed PW as arguments, insert them into db
func CreateVehicle ¶
func CreateVehicle(newVehicle models.NewVehicle) (*int64, error)
CreateVehicle Takes newVehicle, creates in db, returns id
func DeleteAlert ¶
DeleteAlert Take alert id as arg, delete Alert from alert table where id present
func DeleteLabel ¶
DeleteLabel Take label id as arg, delete Label from label table where id present
func DeleteTask ¶
DeleteTask Take task id as arg, delete Task from task table where id present
func DeleteUser ¶
DeleteUser Take username as arg, delete User from user table where username present
func DeleteVehicle ¶
DeleteVehicle Take vehicle id as arg, delete Vehicle from vehicle table where id present
func EditAlert ¶
EditAlert Take Alert as arg, build update query with QueryBuilder, update it in db via generated query
func EditJob ¶
EditJob Take Job as arg, build update query with QueryBuilder, update it in db via generated query
func EditLabel ¶
EditLabel Take Label as arg, build update query with QueryBuilder, update it in db via generated query
func EditTask ¶
EditTask Take Task as arg, build update query with QueryBuilder, update it in db via generated query
func EditVehicle ¶
EditVehicle Take Vehicle as arg, build update query with QueryBuilder, update it in db via generated query
func GetAuthInfoByUsername ¶
GetAuthInfoByUsername Take username, retrieve auth info: user ID, isAdmin and the hashed password
func GetUserById ¶
GetUserById Take user ID, return entire user
func GetUserByUsername ¶
GetUserByUsername Take username, return entire user
func GetVehicle ¶
GetVehicle Takes vehicle id, queries it in db, returns vehicle
func LabelProcessor ¶
func LabelProcessor(ids *string, names *string, colors *string, createdTimes *string, updatedTimes *string) ([]models.Label, error)
LabelProcessor takes label cols and convert them into slice of objects ideally this is done as service layer but doing in db layer prevents relooping through results
func ListAlerts ¶
func ListAlerts(userId *string, vehicleId *string, jobId *string, taskId *string, typeStr *string, isRead *string, alertDate *string, searchStr *string, sort *string) ([]*models.Alert, error)
ListAlerts Take filters as args, return Alert list
func ListJobs ¶
func ListJobs(userId *string, vehicleId *string, isTemplate *string, isComplete *string, labelId *string, searchStr *string, sort *string) ([]*models.Job, error)
ListJobs Take filters as args, return Job list
func ListLabels ¶
func ListLabels(userId *string, jobId *string, searchStr *string, sort *string) ([]*models.Label, error)
ListLabels Take filters as args, return Label list
func ListTasks ¶
func ListTasks(jobId int64, isComplete *string, searchStr *string, sort *string) ([]*models.Task, error)
ListTasks Take filters as args, return Task list
func ListUsers ¶
func ListUsers(jobId *string, vehicleId *string, isAdmin *string, searchStr *string, sort *string) ([]*models.User, error)
ListUsers Take filters as args, return User list
func ListVehicles ¶
func ListVehicles(userId *string, jobId *string, searchStr *string, sort *string) ([]*models.Vehicle, error)
ListVehicles Take filters as args, return Vehicle list
func QueryBuilder ¶
func QueryBuilder(query string, joins *[]string, wheres *[]string, likes *[]Like, groupBy *string, sort *string) string
QueryBuilder Take basic parts of SQL query, construct into usable query May need ORM in the future if it gets too complex, but should work fine for basic queries used thus far
func UnassignJobLabel ¶
UnassignJobLabel Takes job id and task id, deletes job_label entry in db if its exists
func UpdatePassword ¶
UpdatePassword Take username and hashed pw as args, update it in db
func UpdateTaskStatus ¶
UpdateTaskStatus Take job id, task id, status as args, build update query with QueryBuilder, update it in db via generated query