applications

package
v0.0.0-...-c190d2f Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(db *model.Database, id uuid.UUID) (int, error)

Deletes an application from the database id should be parsed to a UUID to ensure its validity. The 'int' return on this function is the HTTP status code which should be sent back to the user upon calling this function.

func Insert

func Insert(db *model.Database, app *model.Application) (int, error)

Insert an application into the database. Object(id) should not exist in the database already. The 'int' return of this function is the HTTP status code which should be send back to the client upon calling this function.

func MatchColumns

func MatchColumns(c *[]string) (msg string)

Match an array of inputted data columns and updates inputted array to validated array of data columns which can be stored in the db. A message will be returned which tells the called which columns were invalid. Valid column names are below, case insensitive. Username, First, Last, Full, Email, Password, Data Does not allow for duplicate columns.

func New

func New(name string, columns []string) *model.Application

Create an application using the provided input. The columns slice is not validated in this function.

func Overwrite

func Overwrite(db *model.Database, id uuid.UUID, name string, columns []string) (*model.Application, string, int, error)

Overwrites an application in the database. The 'id' parameter should be parsed into a UUID to ensure validity. All parameters should be provided in the request body. Other they will be set to their default values. The 'int' return of this function is the HTTP status code that should be sent back to the user upon calling this function.

func Retrieve

func Retrieve(db *model.Database, id uuid.UUID) (*model.Application, int, error)

Retrieves an application from the database. 'id' parameter should be parsed into a UUID to ensure validity. The 'int' return of this function is the HTTP status code that should be sent back to the user upon calling this function.

func RetrieveAll

func RetrieveAll(db *model.Database) ([]*model.Application, int, error)

Retrieves all applications from the database. The 'int' return of this function is the HTTP status code that should be sent back to the user upon requesting this data.

func Update

func Update(db *model.Database, id uuid.UUID, name string, columns []string) (*model.Application, string, int, error)

Updates an application in the database. The 'id' parameter should be parsed into a UUID to ensure validity. Only provided parameters will be updated. The 'int' return of this function is the HTTP status code that should be sent back to the user upon calling this function.

func Validate

func Validate(db *model.Database, id uuid.UUID) (*model.Application, int, error)

Validates an application to ensure the required fields are present and no duplicate columns are present. The 'int' return of this function is the HTTP status code that should be sent back to the user upon calling this function.

Types

This section is empty.

Jump to

Keyboard shortcuts

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