models

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPasswordHash

func CheckPasswordHash(password, hash string) bool

func DeleteApplication

func DeleteApplication(db *sql.DB, id int) (int64, error)

func DeleteAttachment

func DeleteAttachment(db *sql.DB, id int) (int64, error)

func DeleteCategory

func DeleteCategory(db *sql.DB, id int) (int64, error)

func DeleteSubmission

func DeleteSubmission(db *sql.DB, id int) (int64, error)

func DeleteUser

func DeleteUser(db *sql.DB, id int) (int64, error)

func HashPassword

func HashPassword(password string) (string, error)

func PutApplication

func PutApplication(db *sql.DB, name string, category_id int) (int64, error)

func PutAttachment

func PutAttachment(db *sql.DB, filepath string, screenshot bool, submission_id int) (int64, error)

func PutCategory

func PutCategory(db *sql.DB, name string) (int64, error)

func PutSubmission

func PutSubmission(db *sql.DB, name string, user_id int, application_id int) (int64, error)

func PutUser

func PutUser(db *sql.DB, name string, email string, password string) (int64, error)

func UpdateApplication

func UpdateApplication(db *sql.DB, id int, name string, category_id int) (int64, error)

func UpdateAttachment

func UpdateAttachment(db *sql.DB, id int, filepath string, screenshot bool) (int64, error)

func UpdateCategory

func UpdateCategory(db *sql.DB, id int, name string) (int64, error)

func UpdateSubmission

func UpdateSubmission(db *sql.DB, id int, name string) (int64, error)

func UpdateUser

func UpdateUser(db *sql.DB, id int, name string, email string) (int64, error)

Types

type Application

type Application struct {
	ID         int       `json:"id"`
	Name       string    `json:"name"`
	CategoryID int       `json:"category_id"`
	Updated    time.Time `json:"updated"`
	Created    time.Time `json:"created"`
}

func GetApplication

func GetApplication(db *sql.DB, id int) (*Application, error)

func GetApplications

func GetApplications(db *sql.DB, category_id int) ([]Application, error)

type Attachment

type Attachment struct {
	ID           int       `json:"id"`
	Filepath     string    `json:"filepath"`
	Screenshot   bool      `json:"screenshot"`
	SubmissionID int       `json:"submission_id"`
	Updated      time.Time `json:"updated"`
	Created      time.Time `json:"created"`
}

func GetAttachment

func GetAttachment(db *sql.DB, id int) (*Attachment, error)

func GetAttachments

func GetAttachments(db *sql.DB, submission_id int) ([]Attachment, error)

type Category

type Category struct {
	ID      int       `json:"id"`
	Name    string    `json:"name"`
	Created time.Time `json:"created"`
}

func GetCategories

func GetCategories(db *sql.DB) ([]Category, error)

func GetCategory

func GetCategory(db *sql.DB, id int) (*Category, error)

type Submission

type Submission struct {
	ID            int       `json:"id"`
	Name          string    `json:"name"`
	UserID        int       `json:"user_id"`
	ApplicationID int       `json:"application_id"`
	Updated       time.Time `json:"updated"`
	Created       time.Time `json:"created"`
}

func GetSubmission

func GetSubmission(db *sql.DB, id int) (*Submission, error)

func GetSubmissions

func GetSubmissions(db *sql.DB, application_id int, user_id int) ([]Submission, error)

type User

type User struct {
	ID       int       `json:"id"`
	Name     string    `json:"name"`
	Password string    `json:"password"`
	Email    string    `json:"email"`
	Joined   time.Time `json:"joined"`
	LastSeen time.Time `json:"last_seen"`
	IsAdmin  bool      `json:"is_admin"`
}

func Authenticate

func Authenticate(db *sql.DB, username string, password string) (*User, error)

func GetUser

func GetUser(db *sql.DB, id int) (*User, error)

func GetUsers

func GetUsers(db *sql.DB) ([]User, error)

Jump to

Keyboard shortcuts

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