handler

package
v0.0.0-...-a9c8cbe Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2021 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

type Base struct {
	Name            string
	Path            string
	CollectionPath  string
	Unauthenticated bool
	Unauthorized    bool
	Versioned       bool
	Env             env.Env
	Logger          zerolog.Logger
	Database        *sqlx.DB
	RepoStore       *repostore.RepoStore
	ValidationError error

	// models
	TemplateModel       *template.Model
	AppModel            *app.Model
	AppAttributeModel   *attribute.Model
	AppEffectModel      *effect.Model
	AppEntityModel      *entity.Model
	AppEntityGroupModel *entitygroup.Model
	AppFightModel       *fight.Model
	AppItemModel        *item.Model
	AppSkillModel       *skill.Model
}

Base -

func (*Base) BeginHandler

func (h *Base) BeginHandler(r *http.Request) (*ContextData, error)

BeginHandler -

func (*Base) DebugStruct

func (h *Base) DebugStruct(msg string, rec interface{})

DebugStruct -

func (*Base) DecodeRequest

func (h *Base) DecodeRequest(r *http.Request, s interface{}) error

DecodeRequest -

func (*Base) Delete

func (h *Base) Delete(w http.ResponseWriter, r *http.Request)

Delete -

func (*Base) DeleteCollection

func (h *Base) DeleteCollection(w http.ResponseWriter, r *http.Request)

DeleteCollection -

func (*Base) EndHandler

func (h *Base) EndHandler(ctx *ContextData, success bool) error

EndHandler -

func (*Base) Get

func (h *Base) Get(w http.ResponseWriter, r *http.Request)

Get -

func (*Base) GetCollection

func (h *Base) GetCollection(w http.ResponseWriter, r *http.Request)

GetCollection -

func (*Base) GetCollectionPath

func (h *Base) GetCollectionPath() string

GetCollectionPath - Returns configured resource collection path

func (*Base) GetContextData

func (h *Base) GetContextData(r *http.Request) (*ContextData, error)

GetContextData -

func (*Base) GetLogger

func (h *Base) GetLogger() zerolog.Logger

GetLogger -

func (*Base) GetName

func (h *Base) GetName() string

GetName - Returns configured resource name

func (*Base) GetPath

func (h *Base) GetPath() string

GetPath - Returns configured resource path

func (*Base) GetRequestData

func (h *Base) GetRequestData(r *http.Request, rd interface{}) (Params, []error)

GetRequestData -

func (*Base) GetVersioned

func (h *Base) GetVersioned() bool

GetVersioned -

func (*Base) Init

func (h *Base) Init() error

Init -

func (*Base) Options

func (h *Base) Options(w http.ResponseWriter, r *http.Request)

Options -

func (*Base) Post

func (h *Base) Post(w http.ResponseWriter, r *http.Request)

Post -

func (*Base) Put

func (h *Base) Put(w http.ResponseWriter, r *http.Request)

Put -

func (*Base) PutCollection

func (h *Base) PutCollection(w http.ResponseWriter, r *http.Request)

PutCollection -

func (*Base) RequiresAuthentication

func (h *Base) RequiresAuthentication() bool

RequiresAuthentication -

func (*Base) RequiresAuthorization

func (h *Base) RequiresAuthorization() bool

RequiresAuthorization -

func (*Base) SendErrorResponse

func (h *Base) SendErrorResponse(w http.ResponseWriter, ctx *ContextData, errs []error)

SendErrorResponse -

func (*Base) SendResponse

func (h *Base) SendResponse(w http.ResponseWriter, ctx *ContextData, data interface{}) error

SendResponse -

func (*Base) SendSystemErrorResponse

func (h *Base) SendSystemErrorResponse(w http.ResponseWriter, ctx *ContextData, err error)

SendSystemErrorResponse -

func (*Base) Validate

func (h *Base) Validate(str interface{}) (errs []error)

Validate -

func (*Base) ValidateParams

func (h *Base) ValidateParams(r *http.Request) (params Params, errs []error)

ValidateParams -

type ContextData

type ContextData struct {
	Tx *sqlx.Tx
}

ContextData -

type ErrorData

type ErrorData struct {
	Type   string `json:"type"`
	Detail string `json:"detail"`
}

ErrorData -

type ErrorResponse

type ErrorResponse struct {
	Errors []ErrorData `json:"errors"`
}

ErrorResponse -

type Handler

type Handler interface {
	Get(w http.ResponseWriter, r *http.Request)
	Post(w http.ResponseWriter, r *http.Request)
	Put(w http.ResponseWriter, r *http.Request)
	Delete(w http.ResponseWriter, r *http.Request)
	GetCollection(w http.ResponseWriter, r *http.Request)
	PutCollection(w http.ResponseWriter, r *http.Request)
	DeleteCollection(w http.ResponseWriter, r *http.Request)
	GetName() string
	GetPath() string
	GetCollectionPath() string
	RequiresAuthentication() bool
	RequiresAuthorization() bool
	GetVersioned() bool
	GetLogger() zerolog.Logger
	DecodeRequest(r *http.Request, s interface{}) error
}

Handler -

type Params

type Params map[string]interface{}

Params -

Directories

Path Synopsis
Package app -
Package app -
Package appattribute provides handlers for REST methods allowing web clients to manage appattributes
Package appattribute provides handlers for REST methods allowing web clients to manage appattributes
Package appeffect provides handlers for REST methods allowing web clients to manage appeffects
Package appeffect provides handlers for REST methods allowing web clients to manage appeffects
Package appeffectattribute provides handlers for REST methods allowing web clients to manage appentityitems
Package appeffectattribute provides handlers for REST methods allowing web clients to manage appentityitems
Package appentity -
Package appentity -
Package appentityattribute provides handlers for REST methods allowing web clients to manage appentityattributes
Package appentityattribute provides handlers for REST methods allowing web clients to manage appentityattributes
Package appentitygroup -
Package appentitygroup -
Package appentitygroupmember provides handlers for REST methods allowing web clients to manage appentitygroupmembers
Package appentitygroupmember provides handlers for REST methods allowing web clients to manage appentitygroupmembers
Package appentityitem provides handlers for REST methods allowing web clients to manage appentityitems
Package appentityitem provides handlers for REST methods allowing web clients to manage appentityitems
Package appentityskill provides handlers for REST methods allowing web clients to manage appentityskills
Package appentityskill provides handlers for REST methods allowing web clients to manage appentityskills
Package appentitytactic provides handlers for REST methods allowing web clients to manage appentitytactics
Package appentitytactic provides handlers for REST methods allowing web clients to manage appentitytactics
Package appfight provides handlers for REST methods allowing web clients to manage
Package appfight provides handlers for REST methods allowing web clients to manage
Package appfightentitygroup provides handlers for REST methods allowing web clients to manage appfightentitygroups
Package appfightentitygroup provides handlers for REST methods allowing web clients to manage appfightentitygroups
Package appfightinstance - REST API handlers
Package appfightinstance - REST API handlers
Package appfightinstanceturn - REST API handlers
Package appfightinstanceturn - REST API handlers
Package appitem provides handlers for REST methods allowing web clients to manage appitems
Package appitem provides handlers for REST methods allowing web clients to manage appitems
Package appitemeffect provides handlers for REST methods allowing web clients to manage appitemeffects
Package appitemeffect provides handlers for REST methods allowing web clients to manage appitemeffects
Package appskill provides handlers for REST methods allowing web clients to manage appskills
Package appskill provides handlers for REST methods allowing web clients to manage appskills
Package appskilleffect provides handlers for REST methods allowing web clients to manage appskilleffects
Package appskilleffect provides handlers for REST methods allowing web clients to manage appskilleffects
Package doc serves content from the ./www/doc directory
Package doc serves content from the ./www/doc directory
Package template provides handlers for REST methods allowing web clients to manage templates
Package template provides handlers for REST methods allowing web clients to manage templates

Jump to

Keyboard shortcuts

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