controllers

package
v0.0.0-...-1aaf8f9 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2018 License: MIT Imports: 13 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Start

func Start()

Start initializes all the controllers and routes.

Types

type Channels

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

func NewChannels

func NewChannels(phxDB *gorm.DB) *Channels

func (*Channels) CreateChannel

func (ctrl *Channels) CreateChannel(payload *payloads.CreateChannel) ControllerFunc

CreateChannel creates a new channel.

func (*Channels) GetChannel

func (ctrl *Channels) GetChannel(id int) ControllerFunc

GetChannel finds a single channel by its ID.

type ControllerFunc

type ControllerFunc func() (*responses.Response, failures.Failure)

ControllerFunc is the execution API that any function called in a route must conform to. It executes, then returns a response that can be handled.

type FoxContext

type FoxContext struct {
	echo.Context
	// contains filtered or unexported fields
}

FoxContext is a wrapper around echo.Context that eases error handling, provides helper methods, and ensures we have consistent response handling.

func NewFoxContext

func NewFoxContext(c echo.Context) *FoxContext

NewFoxContext creates a new FoxContext from an existing echo.Context.

func (*FoxContext) BindJSON

func (fc *FoxContext) BindJSON(payload payloads.Payload)

BindJSON grabs the JSON payload and unmarshals it into the interface provided.

func (*FoxContext) ParamInt

func (fc *FoxContext) ParamInt(name string) int

ParamInt parses an integer from the parameters list (as defined by the URI).

func (*FoxContext) ParamString

func (fc *FoxContext) ParamString(name string) string

ParamString parses an string from the parameters list (as defined by the URI).

func (*FoxContext) Run

func (fc *FoxContext) Run(ctrlFn ControllerFunc) error

Run executes the primary controller method and returns the response.

type Router

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

func NewRouter

func NewRouter() *Router

func (*Router) GET

func (r *Router) GET(uri string, rf RouterFunc)

func (*Router) POST

func (r *Router) POST(uri string, rf RouterFunc)

func (*Router) Run

func (r *Router) Run(port int)

type RouterFunc

type RouterFunc func(fc *FoxContext) error

Jump to

Keyboard shortcuts

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