controllers

package
v8.3.4+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2017 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterController

func RegisterController(app *iris.Application, path string, c interface{})

Types

type Controller

type Controller struct {
	// path params.
	Params *context.RequestParams

	// view properties.
	Layout string
	Tmpl   string
	Data   map[string]interface{}

	// give access to the request context itself.
	Ctx context.Context
}

type Index

type Index struct {
	Controller
}

Index is our index example controller.

func (*Index) Get

func (c *Index) Get()

type User

type User struct {
	Controller

	// All fields that are tagged with iris:"persistence"`
	// are being persistence and kept between the different requests,
	// meaning that these data will not be reset-ed on each new request,
	// they will be the same for all requests.
	CreatedAt time.Time             `iris:"persistence"`
	Title     string                `iris:"persistence"`
	DB        *persistence.Database `iris:"persistence"`
}

User is our user example controller.

func NewUserController

func NewUserController(db *persistence.Database) *User

func (*User) Get

func (c *User) Get()

Get serves using the User controller when HTTP Method is "GET".

Jump to

Keyboard shortcuts

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