controller

package
v0.0.0-...-da2e21c Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2019 License: MIT Imports: 25 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateController

func CreateController(actualController extension.Controller, model extension.Model) extension.Controller

CreateController creates a new instance of actual controller with BaseController

func GetAPIEndpoints

func GetAPIEndpoints(c *gin.Context)

GetAPIEndpoints returns endpoints of Clay API

Types

type BaseController

type BaseController struct {
	// contains filtered or unexported fields
}

BaseController is the base class that all controller classes inherit

func (*BaseController) Bind

func (receiver *BaseController) Bind(c *gin.Context, resourceName string) (interface{}, error)

Bind binds input data to a container instance

func (*BaseController) Create

func (receiver *BaseController) Create(c *gin.Context)

Create corresponds HTTP POST message and handles a request for multi resource to create a new information

func (*BaseController) Delete

func (receiver *BaseController) Delete(c *gin.Context)

Delete corresponds HTTP DELETE message and handles a request for a single resource to delete the specific information

func (*BaseController) DoAfterDBMigration

func (receiver *BaseController) DoAfterDBMigration(_ *gorm.DB) error

DoAfterDBMigration execute initialization process after DB migration

func (*BaseController) DoAfterRouterSetup

func (receiver *BaseController) DoAfterRouterSetup(_ *gin.Engine) error

DoAfterRouterSetup execute initialization process after Router initialization

func (*BaseController) DoBeforeDBMigration

func (receiver *BaseController) DoBeforeDBMigration(_ *gorm.DB) error

DoBeforeDBMigration execute initialization process before DB migration

func (*BaseController) DoBeforeRouterSetup

func (receiver *BaseController) DoBeforeRouterSetup(_ *gin.Engine) error

DoBeforeRouterSetup execute initialization process before Router initialization

func (*BaseController) GetModel

func (receiver *BaseController) GetModel() extension.Model

GetModel returns its model

func (*BaseController) GetMulti

func (receiver *BaseController) GetMulti(c *gin.Context)

GetMulti corresponds HTTP GET message and handles a request for multi resource to get the list of information

func (*BaseController) GetOptions

func (receiver *BaseController) GetOptions(c *gin.Context)

GetOptions corresponds HTTP OPTIONS message and handles a request for multi resources to retrieve its supported options

func (*BaseController) GetQueries

func (receiver *BaseController) GetQueries(c *gin.Context) url.Values

GetQueries returns query parameters

func (*BaseController) GetResourceMultiURL

func (receiver *BaseController) GetResourceMultiURL() (string, error)

GetResourceMultiURL builds a resource url what represents multi resources based on the argument

func (*BaseController) GetResourceName

func (receiver *BaseController) GetResourceName() (string, error)

GetResourceName returns its resource/table name in REST/DB

func (*BaseController) GetResourceSingleURL

func (receiver *BaseController) GetResourceSingleURL() (string, error)

GetResourceSingleURL builds a resource url what represents a single resource based on the argument

func (*BaseController) GetSingle

func (receiver *BaseController) GetSingle(c *gin.Context)

GetSingle corresponds HTTP GET message and handles a request for a single resource to get the information

func (*BaseController) OutputCreate

func (receiver *BaseController) OutputCreate(c *gin.Context, code int, result interface{})

OutputCreate corresponds HTTP POST message and handles the output of a single result from logic classes

func (*BaseController) OutputDelete

func (receiver *BaseController) OutputDelete(c *gin.Context, code int)

OutputDelete corresponds HTTP DELETE message and handles the code result from logic classes

func (*BaseController) OutputError

func (receiver *BaseController) OutputError(c *gin.Context, code int, err error)

OutputError handles an error output

func (*BaseController) OutputGetMulti

func (receiver *BaseController) OutputGetMulti(c *gin.Context, code int, result interface{}, total int, countBeforePagination int, fields map[string]interface{})

OutputGetMulti corresponds HTTP GET message and handles the output of multiple result from logic classes

func (*BaseController) OutputGetOptions

func (receiver *BaseController) OutputGetOptions(c *gin.Context, code int)

OutputGetOptions corresponds HTTP OPTIONS message and handles the code result from logic classes, as well as OutputDelete

func (*BaseController) OutputGetSingle

func (receiver *BaseController) OutputGetSingle(c *gin.Context, code int, result interface{}, fields map[string]interface{})

OutputGetSingle corresponds HTTP GET message and handles the output of a single result from logic classes

func (*BaseController) OutputPatch

func (receiver *BaseController) OutputPatch(c *gin.Context, code int, result interface{})

OutputPatch corresponds HTTP PATCH message and handles the output of a single result from logic classes

func (*BaseController) OutputUpdate

func (receiver *BaseController) OutputUpdate(c *gin.Context, code int, result interface{})

OutputUpdate corresponds HTTP PUT message and handles the output of a single result from logic classes

func (*BaseController) Patch

func (receiver *BaseController) Patch(c *gin.Context)

Patch corresponds HTTP PATCH message and handles a request for a single resource to update partially the specific information

func (*BaseController) Update

func (receiver *BaseController) Update(c *gin.Context)

Update corresponds HTTP PUT message and handles a request for a single resource to update the specific information

Jump to

Keyboard shortcuts

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