webtool

package module
v0.0.0-...-f324cb5 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2013 License: MIT Imports: 8 Imported by: 0

README

webtool

golang web tool

Documentation

Index

Constants

View Source
const (
	DefaultPattern = "[^/]+"
)

Variables

This section is empty.

Functions

func IsActionError

func IsActionError(err ActionError) bool

func TagContent

func TagContent(str string) (tagContent string, ok bool)

<CONTENT> -> CONTENT

Types

type ActionError

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

func NewActionError

func NewActionError(code string, message string) ActionError

func (ActionError) Code

func (e ActionError) Code() string

func (ActionError) Error

func (e ActionError) Error() string

type ActionFunc

type ActionFunc func(TransactionInterface) (string, ActionError)

type ActionFunc func(map[string]string, http.ResponseWriter, *http.Request) (string, ActionError)

type ErrorFunc

type ErrorFunc func(string, http.ResponseWriter, *http.Request)

type Executor

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

func (*Executor) Exec

func (e *Executor) Exec(w http.ResponseWriter, r *http.Request) (string, ActionError)

type HttpRouter

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

func NewHttpRouter

func NewHttpRouter() *HttpRouter

func (*HttpRouter) GetAction

func (self *HttpRouter) GetAction(urlPath string) (Executor, error)

func (*HttpRouter) ServeHTTP

func (self *HttpRouter) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*HttpRouter) SetBasePath

func (self *HttpRouter) SetBasePath(basePath string) *HttpRouter

func (*HttpRouter) SetError

func (self *HttpRouter) SetError(errorCode string, errorFunc ErrorFunc) *HttpRouter

func (*HttpRouter) SetRoute

func (self *HttpRouter) SetRoute(pathPattern string, action ActionFunc) *HttpRouter

type PathMatch

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

func NewPathMatch

func NewPathMatch() *PathMatch

func (*PathMatch) GetRegexp

func (p *PathMatch) GetRegexp(str string, defaults map[string]string) (string, error)

<name:pattern> -> (?P<name>pattern) <name> -> (?P<name>defaultPattern) otherString -> regexp.QuoteMeta(otherString)

func (*PathMatch) Match

func (p *PathMatch) Match(path string) (result string, matches map[string]string, ok bool)

return pathPattern

func (*PathMatch) Parse

func (p *PathMatch) Parse(pathPattern string, defaults map[string]string) error

type Transaction

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

type TransactionInterface

type TransactionInterface interface {
	Writer() http.ResponseWriter
	Request() *http.Request
	DefaultParams() map[string]string
}

type TransactionWithDb

type TransactionWithDb struct {
	*Transaction
}

データベースを使用する場合のトランザクション

type TransactionWithDbInterface

type TransactionWithDbInterface interface {
	TransactionInterface
	SetDb(*sql.DB)
	Db() *sql.DB
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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