resource

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BadRequest

func BadRequest(c *gin.Context, err error)

BadRequest is a convenience function for 400 response.

func Conflict

func Conflict(c *gin.Context, err error)

Conflict is a convenience function for 409 response.

func Created

func Created(c *gin.Context, data any)

Created is a convenience function for 201 response.

func Error

func Error(c *gin.Context, err error)

Error is a convenience function for 500 response.

func NotFound

func NotFound(c *gin.Context, err error)

NotFound is a convenience function for 404 response.

func OK

func OK(c *gin.Context, data any)

OK is a convenience function for 200 response.

func Unauthorized

func Unauthorized(c *gin.Context, err error)

Unauthorized is a convenience function for 401 response.

Types

type ReqAccessToken

type ReqAccessToken struct {
	Authorization string `header:"Authorization" binding:"required"`
}

ReqAccessToken binds header for authorized access.

type ReqAddLedger

type ReqAddLedger struct {
	UserID string `json:"user_id" binding:"required"`
	Desc   string `json:"description" binding:"required"`
	Income int    `json:"income" binding:"required"`
	Date   string `json:"date" binding:"required,datetime=2006-01-02"`
}

ReqAddLedger binds request body for adding ledger.

type ReqGetLedger

type ReqGetLedger struct {
	LedgerID uint `uri:"ledger_id" binding:"min=1"`
}

ReqGetLedger binds path variable for getting a ledger.

type ReqGetLedgers

type ReqGetLedgers struct {
	UserID string `uri:"user_id" binding:"required"`
}

ReqGetLedgers binds path variable for getting ledgers.

type ReqSignIn

type ReqSignIn struct {
	Email    string `json:"email" binding:"email"`
	Password string `json:"password" binding:"required,min=8,max=18"`
}

ReqSignIn binds request body for sign in.

type ReqSignUp

type ReqSignUp struct {
	Email    string `json:"email" binding:"email"`
	Password string `json:"password" binding:"required,min=8,max=18"`
}

ReqSignUp binds request body for sign up.

type ResAddLedger

type ResAddLedger struct {
	LedgerID int    `json:"ledger_id"`
	UserID   string `json:"user_id"`
}

ResAddLedger is a response for adding ledger.

type ResErr

type ResErr struct {
	Error string `json:"error"`
}

ResErr returns error response.

type ResGetLedger

type ResGetLedger struct {
	LedgerID string `json:"ledger_id"`
	UserID   string `json:"user_id"`
	Desc     string `json:"description"`
	Income   int    `json:"income"`
	Date     string `json:"date"`
}

ResGetLedger is a response for getting a ledger.

type ResGetLedgers

type ResGetLedgers struct {
	Ledgers []ResGetLedger `json:"ledgers"`
}

ResGetLedgers is a response for getting ledgers.

type ResGetTime

type ResGetTime struct {
	Timestamp string `json:"timestamp"`
	Date      string `json:"date"`
}

ResGetTime returns current timestamp and date.

type ResSignIn

type ResSignIn struct {
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
}

ResSignIn binds response body for sign in.

type ResSignUp

type ResSignUp struct {
	UserID string `json:"user_id"`
}

ResSignUp binds response body for sign up.

Jump to

Keyboard shortcuts

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