tango

package module
v0.0.0-...-57962ab Latest Latest
Warning

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

Go to latest
Published: May 30, 2014 License: MIT Imports: 18 Imported by: 0

README

While this framework does indeed work, it should be considered stale and not production ready. I'd suggest you check out Negroni .

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Debug = false

Special Debug variable... used anywhere and everywhere, so let's make it easy.

View Source
var LogDebug = log.New(ioutil.Discard, "", log.LstdFlags)

This logger will out put with the prefix "[Tango D] " when Debug mode is true.

View Source
var LogError = log.New(os.Stderr, "[Tango E] ", log.Ldate|log.Ltime|log.Lshortfile)
View Source
var LogInfo = log.New(os.Stdout, "[Tango I] ", log.Ldate|log.Ltime)

Normal usage loggers.

View Source
var Settings = NewDictObj()

Convention will be json style settings. Try to keep it a single level deep. Key values should be lower_case_with_underscores. Ex: debug, or secret_key.

View Source
var Version = "0.0.2"

Functions

func ListenAndServe

func ListenAndServe()

func Middleware

func Middleware(m MiddlewareInterface)

func Mixin

func Mixin(m MixinInterface)

func NewTestClient

func NewTestClient(t *testing.T) *testClient

func Pattern

func Pattern(pat string, h HandlerInterface)

func SendMail

func SendMail(subject, message, to_address string) error

func SendMailFrom

func SendMailFrom(subject, message, to_address, from_address string) error

func SendMassMail

func SendMassMail(subject, message string, to_addresses []string) error

func SendMassMailFrom

func SendMassMailFrom(subject, message, from_address string, to_addresses []string) error

func SetNotFoundHandler

func SetNotFoundHandler(h HandlerInterface)

func VersionMap

func VersionMap() [3]int

Types

type BaseHandler

type BaseHandler struct{}

func (*BaseHandler) Delete

func (h *BaseHandler) Delete(request *HttpRequest) *HttpResponse

func (*BaseHandler) ErrorHandler

func (h *BaseHandler) ErrorHandler(errorStr string) *HttpResponse

func (*BaseHandler) Finish

func (h *BaseHandler) Finish(request *HttpRequest, response *HttpResponse)

func (*BaseHandler) Get

func (h *BaseHandler) Get(request *HttpRequest) *HttpResponse

func (*BaseHandler) Head

func (h *BaseHandler) Head(request *HttpRequest) *HttpResponse

func (*BaseHandler) HttpResponseBadRequest

func (h *BaseHandler) HttpResponseBadRequest() *HttpResponse

func (*BaseHandler) HttpResponseForbidden

func (h *BaseHandler) HttpResponseForbidden() *HttpResponse

func (*BaseHandler) HttpResponseGone

func (h *BaseHandler) HttpResponseGone() *HttpResponse

func (*BaseHandler) HttpResponseNotAllowed

func (h *BaseHandler) HttpResponseNotAllowed() *HttpResponse

func (*BaseHandler) HttpResponseNotFound

func (h *BaseHandler) HttpResponseNotFound() *HttpResponse

func (*BaseHandler) HttpResponseNotModified

func (h *BaseHandler) HttpResponseNotModified() *HttpResponse

func (*BaseHandler) HttpResponseServerError

func (h *BaseHandler) HttpResponseServerError() *HttpResponse

func (*BaseHandler) Options

func (h *BaseHandler) Options(request *HttpRequest) *HttpResponse

func (*BaseHandler) Patch

func (h *BaseHandler) Patch(request *HttpRequest) *HttpResponse

func (*BaseHandler) PermanentRedirect

func (h *BaseHandler) PermanentRedirect(request *HttpRequest, urlStr string) *HttpResponse

func (*BaseHandler) Post

func (h *BaseHandler) Post(request *HttpRequest) *HttpResponse

func (*BaseHandler) Prepare

func (h *BaseHandler) Prepare(request *HttpRequest) *HttpResponse

func (*BaseHandler) Put

func (h *BaseHandler) Put(request *HttpRequest) *HttpResponse

func (*BaseHandler) TemporaryRedirect

func (h *BaseHandler) TemporaryRedirect(request *HttpRequest, urlStr string) *HttpResponse

type BaseMiddleware

type BaseMiddleware struct{}

func (*BaseMiddleware) ProcessRequest

func (m *BaseMiddleware) ProcessRequest(request *HttpRequest) *HttpResponse

func (*BaseMiddleware) ProcessResponse

func (m *BaseMiddleware) ProcessResponse(request *HttpRequest, response *HttpResponse)

type BaseMixin

type BaseMixin struct{}

func (*BaseMixin) InitMixin

func (m *BaseMixin) InitMixin()

type DictObj

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

func NewDictObj

func NewDictObj() DictObj

func (*DictObj) Array

func (s *DictObj) Array(key string, args ...[]interface{}) []interface{}

func (*DictObj) Bool

func (s *DictObj) Bool(key string, args ...bool) bool

func (*DictObj) Exists

func (s *DictObj) Exists(key string) bool

func (*DictObj) Float

func (s *DictObj) Float(key string, args ...float64) float64

func (*DictObj) Int

func (s *DictObj) Int(key string, args ...int) int

func (*DictObj) LoadFromFile

func (s *DictObj) LoadFromFile(filepath string)

func (*DictObj) Set

func (s *DictObj) Set(key string, val interface{})

func (*DictObj) SetFromEnv

func (s *DictObj) SetFromEnv(key, envKey string, args ...interface{})

func (*DictObj) String

func (s *DictObj) String(key string, args ...string) string

type HandlerInterface

type HandlerInterface interface {
	New() HandlerInterface
	Head(request *HttpRequest) *HttpResponse
	Get(request *HttpRequest) *HttpResponse
	Post(request *HttpRequest) *HttpResponse
	Put(request *HttpRequest) *HttpResponse
	Patch(request *HttpRequest) *HttpResponse
	Delete(request *HttpRequest) *HttpResponse
	Options(request *HttpRequest) *HttpResponse

	PermanentRedirect(request *HttpRequest, urlStr string) *HttpResponse
	TemporaryRedirect(request *HttpRequest, urlStr string) *HttpResponse

	Prepare(request *HttpRequest) *HttpResponse
	Finish(request *HttpRequest, response *HttpResponse)
	ErrorHandler(errorStr string) *HttpResponse
}

type HttpRequest

type HttpRequest struct {
	http.Request
	BodyString string
	PathArgs   url.Values
	Registry   map[string]interface{}
}

func NewHttpRequest

func NewHttpRequest(orig *http.Request, params url.Values) *HttpRequest

func (*HttpRequest) FormArray

func (r *HttpRequest) FormArray(key string) ([]string, bool)

func (*HttpRequest) FormFloat

func (r *HttpRequest) FormFloat(key string, args ...float64) float64

func (*HttpRequest) FormInt

func (r *HttpRequest) FormInt(key string, args ...int64) int64

func (*HttpRequest) FormString

func (r *HttpRequest) FormString(key string, args ...string) string

func (*HttpRequest) FormValue

func (r *HttpRequest) FormValue(key string) (string, bool)

func (*HttpRequest) FragmentValue

func (r *HttpRequest) FragmentValue() string

func (*HttpRequest) GetArray

func (r *HttpRequest) GetArray(key string) ([]string, bool)

func (*HttpRequest) GetFloat

func (r *HttpRequest) GetFloat(key string, args ...float64) float64

func (*HttpRequest) GetInt

func (r *HttpRequest) GetInt(key string, args ...int64) int64

func (*HttpRequest) GetString

func (r *HttpRequest) GetString(key string, args ...string) string

func (*HttpRequest) GetValue

func (r *HttpRequest) GetValue(key string) (string, bool)

func (*HttpRequest) IsSecure

func (r *HttpRequest) IsSecure() bool

Info methods.

func (*HttpRequest) PathValue

func (r *HttpRequest) PathValue(key string) (string, bool)

Retrive specific values.

type HttpResponse

type HttpResponse struct {
	Content     string
	StatusCode  int
	ContentType string
	Context     map[string]interface{}
	Header      http.Header
}

func NewHttpResponse

func NewHttpResponse(args ...interface{}) *HttpResponse

type HttpTestResponse

type HttpTestResponse struct {
	*HttpResponse
}

func (*HttpTestResponse) Json

func (h *HttpTestResponse) Json() interface{}

func (*HttpTestResponse) JsonMap

func (h *HttpTestResponse) JsonMap() map[string]interface{}

func (*HttpTestResponse) JsonSlice

func (h *HttpTestResponse) JsonSlice() []interface{}

type MiddlewareInterface

type MiddlewareInterface interface {
	ProcessRequest(request *HttpRequest) *HttpResponse
	ProcessResponse(request *HttpRequest, response *HttpResponse)
}

type MixinInterface

type MixinInterface interface {
	InitMixin()
}

type NotFoundHandler

type NotFoundHandler struct{ BaseHandler }

404 - Not Found

func (*NotFoundHandler) Delete

func (h *NotFoundHandler) Delete(request *HttpRequest) *HttpResponse

func (*NotFoundHandler) Get

func (h *NotFoundHandler) Get(request *HttpRequest) *HttpResponse

func (*NotFoundHandler) New

func (*NotFoundHandler) Options

func (h *NotFoundHandler) Options(request *HttpRequest) *HttpResponse

func (*NotFoundHandler) Patch

func (h *NotFoundHandler) Patch(request *HttpRequest) *HttpResponse

func (*NotFoundHandler) Post

func (h *NotFoundHandler) Post(request *HttpRequest) *HttpResponse

func (*NotFoundHandler) Put

func (h *NotFoundHandler) Put(request *HttpRequest) *HttpResponse

type PatternServeMux

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

---

func (*PatternServeMux) ServeHTTP

func (p *PatternServeMux) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP matches r.URL.Path against its routing table using the rules described above.

func (*PatternServeMux) ServeTestResponse

func (p *PatternServeMux) ServeTestResponse(r *http.Request) *HttpResponse

Directories

Path Synopsis
addons
examples
appengine/tangoappengine
Run cmd (from one level up): 'dev_appserver.py app.yaml'
Run cmd (from one level up): 'dev_appserver.py app.yaml'
settings
Run cmd: go run settings_combo.go settings.json Run cmd: go run settings_env.go Run cmd: go run settings_flags.go -debug=true -num=1234 -serve=0.0.0.0:8000 Run cmd: go run settings_json.go Run cmd: go run settings_plain.go
Run cmd: go run settings_combo.go settings.json Run cmd: go run settings_env.go Run cmd: go run settings_flags.go -debug=true -num=1234 -serve=0.0.0.0:8000 Run cmd: go run settings_json.go Run cmd: go run settings_plain.go

Jump to

Keyboard shortcuts

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