controllers

package
v0.0.0-...-3b69553 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateLoan

func CreateLoan(c *gin.Context)

CreateLoan inputs a new loan into the database Route: POST /loans

func DeleteLoan

func DeleteLoan(c *gin.Context)

DeleteLoan deletes the loan entry from the db Route: DELETE /loan/:id

func FindLoan

func FindLoan(c *gin.Context)

FindLoan connects to the database and retrieves a single loan, by id Route: GET /loans/:id

func FindLoans

func FindLoans(c *gin.Context)

FindLoans connects to the database and retrieves all loans inside of it Route: GET /loans

func UpdateLoan

func UpdateLoan(c *gin.Context)

UpdateLoan updates a loan by id. All fields are optional Route: PUT /loans/:id

Types

type CreateLoanInput

type CreateLoanInput struct {
	LoanName     string  `json:"loan_name" binding:"required"`
	Debt         float32 `json:"debt" binding:"required"`
	InterestRate float32 `json:"interest_rate" binding:"required"`
}

A CreateLoanInput respresents the required input from the user to input a new loan

type UpdateLoanInput

type UpdateLoanInput struct {
	ID           uint    `json:"-"`
	LoanName     string  `json:"loan_name"`
	Debt         float32 `json:"debt"`
	InterestRate float32 `json:"interest_rate"`
}

A UpdateLoanInput respresents the input from the user to update an existing loan

Jump to

Keyboard shortcuts

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