Documentation ¶
Index ¶
- Variables
- func CreateNewTag(tag string) (err error)
- func CreateNewUser(email, first, last, hash, salt string) error
- func CreateTagMap(taskId int, tagText string) (err error)
- func CreateTask(text string, owner int) (err error)
- func DeleteTagMap(taskId int, tagText string) (err error)
- func DeleteTask(taskId int) (err error)
- func DeleteUser(userId int) error
- func GetTags(taskId int) ([]string, error)
- func GetTaskById(taskId int) (err error)
- func InitializeDBConnection()
- func UpdateTask(updatedTask TaskObject) (err error)
- func UpdateUser(userId int, fields map[string]string) error
- func VerifyTaskOwner(taskId, taskOwner int) bool
- type TaskObject
- type UserObject
Constants ¶
This section is empty.
Variables ¶
var ( DB *sql.DB DBName = "" DBUser = "" DBPass = "" SSLMode = "" )
Functions ¶
func CreateNewTag ¶
creates a new tag in the tags table returns an error if there is one.
func CreateNewUser ¶
CreateNewUser is an api function for creating a new user. Given the user's form information, add a user to the database. Tjis functions does not do any validation, that should all be done by the handler.
func CreateTagMap ¶
add a tag mapping given the task id number and the tag text string returns an error if there is one.
func CreateTask ¶
Create a new task TODO: Make this (and the database) accept a due date and possibly reminders
func DeleteTagMap ¶
delete a tag mapping given the task id number and the tag text string returns an error if there is one.
func DeleteUser ¶
DeleteUser is an api function for deleting a user and all associated tasks/data.
func GetTaskById ¶
func InitializeDBConnection ¶
func InitializeDBConnection()
func UpdateTask ¶
func UpdateTask(updatedTask TaskObject) (err error)
Takes a TaskObject. This call will replace task_text and due_date with that in the object TODO: Optimize and make not stupid
func UpdateUser ¶
UpdateUser is an api function for updating parts or all of a user's information.
func VerifyTaskOwner ¶
Verify that taskId is owned by taskOwner This is a general purpose api call that should be used before any alteration of an existing task
Types ¶
type TaskObject ¶
func GetAllUserTasks ¶
func GetAllUserTasks(userId int) ([]TaskObject, error)
Get all a user's tasks. Default api call for a freshly logged in user
type UserObject ¶
type UserObject struct { UserId int FirstName string LastName string Email string Salt string Hash string }
func GetUser ¶
func GetUser(email string) (UserObject, error)
GetUser is a general api function for getting a user from an email. Given a user's email gets the user's information and returns it as a UserObject.