rest

package
v0.0.0-...-7cbe417 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2019 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccountRoutes

func AccountRoutes(r *gin.RouterGroup)

AccountRoutes add account related urls inside a gin.router/engine context

func CategoryRoutes

func CategoryRoutes(r *gin.RouterGroup)

CategoryRoutes add category related urls inside a gin.router/engine context

func CreateAccount

func CreateAccount(c *gin.Context)

CreateAccount can be called to create a new instance of Account on database, using props provided via http request

func CreateCategory

func CreateCategory(c *gin.Context)

CreateCategory can be called to create a new instance of Category on database, using props provided via http request

func CreateEntry

func CreateEntry(c *gin.Context)

CreateEntry can be called to create a new instance of Entry on database, using props provided via http request

func CreateEntryTag

func CreateEntryTag(c *gin.Context)

CreateEntryTag can be called to create a new instance of EntryTag on database, using props provided via http request

func CreateTag

func CreateTag(c *gin.Context)

CreateTag can be called to create a new instance of Tag on database, using props provided via http request

func DeleteAccount

func DeleteAccount(c *gin.Context)

DeleteAccount can be used to logical delete a row account from the database.

func DeleteCategory

func DeleteCategory(c *gin.Context)

DeleteCategory can be used to logical delete a row category from the database.

func DeleteEntry

func DeleteEntry(c *gin.Context)

DeleteEntry can be used to logical delete a row entry from the database.

func DeleteEntryTag

func DeleteEntryTag(c *gin.Context)

DeleteEntryTag can be used to logical delete a row entryTag from the database.

func DeleteTag

func DeleteTag(c *gin.Context)

DeleteTag can be used to logical delete a row tag from the database.

func EntryRoutes

func EntryRoutes(r *gin.RouterGroup)

EntryRoutes add entry related urls inside a gin.router/engine context

func EntryTagRoutes

func EntryTagRoutes(r *gin.RouterGroup)

EntryTagRoutes add entryTag related urls inside a gin.router/engine context

func GetAccount

func GetAccount(c *gin.Context)

GetAccount can be called to get a specific account from the database. The uuid used to query is part of the url

func GetAccounts

func GetAccounts(c *gin.Context)

GetAccounts return all accounts

func GetCategories

func GetCategories(c *gin.Context)

GetCategories return all categories

func GetCategory

func GetCategory(c *gin.Context)

GetCategory can be called to get a specific category from the database. The uuid used to query is part of the url

func GetEntries

func GetEntries(c *gin.Context)

GetEntries return all entries

func GetEntry

func GetEntry(c *gin.Context)

GetEntry can be called to get a specific entry from the database. The uuid used to query is part of the url

func GetEntryTag

func GetEntryTag(c *gin.Context)

GetEntryTag can be called to get a specific entryTag from the database. The uuid used to query is part of the url

func GetEntryTags

func GetEntryTags(c *gin.Context)

GetEntryTags return all entry-tags

func GetTag

func GetTag(c *gin.Context)

GetTag can be called to get a specific tag from the database. The uuid used to query is part of the url

func GetTags

func GetTags(c *gin.Context)

GetTags return all tags

func Routes

func Routes(r *gin.RouterGroup)

Routes register api related services into a provided gin.RouterGroup

func TagRoutes

func TagRoutes(r *gin.RouterGroup)

TagRoutes add tag related urls inside a gin.router/engine context

func UpdateAccount

func UpdateAccount(c *gin.Context)

UpdateAccount can be called to update a specific account. The uuid used to query is part of the url

func UpdateCategory

func UpdateCategory(c *gin.Context)

UpdateCategory can be called to update a specific category. The uuid used to query is part of the url

func UpdateEntry

func UpdateEntry(c *gin.Context)

UpdateEntry can be called to update a specific entry. The uuid used to query is part of the url

func UpdateTag

func UpdateTag(c *gin.Context)

UpdateTag can be called to update a specific tag. The uuid used to query is part of the url

Types

type PaginatedMessage

type PaginatedMessage struct {
	Total int `json:"total"`
	Page  int `json:"page"`
	Pages int `json:"pages"`
	//Next string `json:"next"`
	//Previous string `json:"previous"`
	Limit int         `json:"limit"`
	Count int         `json:"count"`
	Data  interface{} `json:"data"`
}

PaginatedMessage is a structure which contains standard attributes to be used on paginated services

type QueryData

type QueryData struct {
	Page    int
	Pages   int
	Total   int
	Limit   int
	Sort    string
	Filters map[string]interface{}
}

QueryData is structure which contains standard atributes to parse http parameters for API filter, search and pagination

func ExtractFilters

func ExtractFilters(f url.Values) QueryData

ExtractFilters can be used to parse query parameters and return a QueryData object, useful to query, filter and paginate requests

func (*QueryData) Build

func (q *QueryData) Build(db *gorm.DB) *gorm.DB

Build is the function where the QueryData attributes are translated into a gorm.DB instance. Can be used to generic filter, order and pagination

Jump to

Keyboard shortcuts

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