controller

package
v0.0.0-...-12a504c Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2019 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseControl

type BaseControl struct {
	DB          *gorm.DB
	Validator   *validator.Validate
	RedisClient *redis.Client
	Model       interface{}
}

BaseControl representing the structure of a RESTful API handler

func (*BaseControl) Delete

func (ctrl *BaseControl) Delete(ctx *gin.Context)

Delete corresponds http Delete method

func (*BaseControl) GetAll

func (ctrl *BaseControl) GetAll(ctx *gin.Context)

GetAll corresponds http Get method

func (*BaseControl) GetByID

func (ctrl *BaseControl) GetByID(ctx *gin.Context)

GetByID corresponds http Get :id method

func (*BaseControl) Head

func (ctrl *BaseControl) Head(ctx *gin.Context)

Head corresponds http Head method

func (*BaseControl) Init

func (ctrl *BaseControl) Init(db *gorm.DB, validate *validator.Validate, redis *redis.Client, model interface{})

Init inits the Control data

func (*BaseControl) Options

func (ctrl *BaseControl) Options(ctx *gin.Context)

Options corresponds http Options method

func (*BaseControl) Patch

func (ctrl *BaseControl) Patch(ctx *gin.Context)

Patch corresponds http Patch method

func (*BaseControl) Post

func (ctrl *BaseControl) Post(ctx *gin.Context)

Post corresponds http Post method

func (*BaseControl) Prepare

func (ctrl *BaseControl) Prepare()

Prepare corresponds http Prepare method

type Controller

type Controller interface {
	Init(...interface{})
	Prepare()
	Post(ctx *gin.Context)
	Patch(ctx *gin.Context)
	Delete(ctx *gin.Context)
	GetByID(ctx *gin.Context)
	GetAll(ctx *gin.Context)
	Head(ctx *gin.Context)
	Options(ctx *gin.Context)
}

Controller is an control interface based on go-gin

Jump to

Keyboard shortcuts

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