web

package
v0.0.0-...-f928fa1 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2018 License: MPL-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrSessionServiceNotPresent ...
	ErrSessionServiceNotPresent = errors.New("Session service not present in the request context")
	// ErrClientNotPresent ...
	ErrClientNotPresent = errors.New("Client not present in the request context")
)
View Source
var ErrIncorrectResponseType = errors.New("Response type not one of token or code")

ErrIncorrectResponseType a form value for response_type was not set to token or code

Functions

func Asset

func Asset(name string) ([]byte, error)

Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetDir

func AssetDir(name string) ([]string, error)

AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:

data/
  foo.txt
  img/
    a.png
    b.png

then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.

func AssetInfo

func AssetInfo(name string) (os.FileInfo, error)

AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetNames

func AssetNames() []string

AssetNames returns the names of the assets.

func MustAsset

func MustAsset(name string) []byte

MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.

func RestoreAsset

func RestoreAsset(dir, name string) error

RestoreAsset restores an asset under the given directory

func RestoreAssets

func RestoreAssets(dir, name string) error

RestoreAssets restores an asset under the given directory recursively

Types

type Service

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

Service struct keeps variables for reuse

func NewService

func NewService(cnf *config.Config, oauthService oauth.ServiceInterface, sessionService session.ServiceInterface) *Service

NewService returns a new Service instance

func (*Service) Close

func (s *Service) Close()

Close stops any running services

func (*Service) GetConfig

func (s *Service) GetConfig() *config.Config

GetConfig returns config.Config instance

func (*Service) GetOauthService

func (s *Service) GetOauthService() oauth.ServiceInterface

GetOauthService returns oauth.Service instance

func (*Service) GetRoutes

func (s *Service) GetRoutes() []routes.Route

GetRoutes returns []routes.Route slice for the health service

func (*Service) GetSessionService

func (s *Service) GetSessionService() session.ServiceInterface

GetSessionService returns session.Service instance

func (*Service) RegisterRoutes

func (s *Service) RegisterRoutes(router *mux.Router, prefix string)

RegisterRoutes registers route handlers for the health service

type ServiceInterface

type ServiceInterface interface {
	// Exported methods
	GetConfig() *config.Config
	GetOauthService() oauth.ServiceInterface
	GetSessionService() session.ServiceInterface
	GetRoutes() []routes.Route
	RegisterRoutes(router *mux.Router, prefix string)
	Close()
	// contains filtered or unexported methods
}

ServiceInterface defines exported methods

type StringBuilder

type StringBuilder []string

func (*StringBuilder) AddTemplate

func (sb *StringBuilder) AddTemplate(t *template.Template, name string, data interface{}) error

func (*StringBuilder) Append

func (sb *StringBuilder) Append(s string)

func (*StringBuilder) Join

func (sb *StringBuilder) Join(s *StringBuilder)

func (*StringBuilder) String

func (sb *StringBuilder) String() string

type UpdateUserForm

type UpdateUserForm struct {
	User      *models.OauthUser
	NickName  string `form:"nickname" validate:"omitempty,min=2"`
	FirstName string `form:"first_name" validate:"max=20"`
	LastName  string `form:"last_name" validate:"max=20"`
	Password  string `form:"password" validate:"omitempty,min=6"`
	AvatarURL string `form:"avatar_url"`
	Mobile    string `form:"mobile" validate:"cnmobile"`
	Errors    validator.ValidationErrors
	// contains filtered or unexported fields
}

func (*UpdateUserForm) AddError

func (f *UpdateUserForm) AddError(name, msg string)

func (*UpdateUserForm) Diff

func (f *UpdateUserForm) Diff() map[string]interface{}

func (*UpdateUserForm) Error

func (f *UpdateUserForm) Error(name string) validator.FieldError

func (*UpdateUserForm) ErrorMsg

func (f *UpdateUserForm) ErrorMsg(name string) string

func (*UpdateUserForm) ErrorStatus

func (f *UpdateUserForm) ErrorStatus(name string) string

func (*UpdateUserForm) ErrorText

func (f *UpdateUserForm) ErrorText(name string) string

func (*UpdateUserForm) Valid

func (f *UpdateUserForm) Valid() bool

Jump to

Keyboard shortcuts

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