lang

package
v0.0.0-...-22804f9 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2012 License: BSD-2-Clause-Views Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeQueries

func EncodeQueries(queries []map[string]interface{}, ignore_lone_id bool) map[string]interface{}

func ToCodeStyle

func ToCodeStyle(a string) string

func ToFileStyle

func ToFileStyle(a string) string

func ToURLStyle

func ToURLStyle(a string) string

Types

type Form

type Form struct {
	FilterFields map[string]interface{}
	ActionPath   string
	KeyPrefix    string
}

type Route

type Route struct {
	Words   []string
	Queries []map[string]interface{}
	// contains filtered or unexported fields
}

func NewRoute

func NewRoute(path string, q map[string]interface{}) (*Route, error)

When creating a route, we essentially move input data from the path to the queries, eg. /cars/:id becomes /cars?id=:id and expanding the flattened query params, eg. /cars/comments?make=bmw&1date=today becomes /cars?make=bmw /comments?date=today

func (*Route) DropOne

func (r *Route) DropOne()

func (*Route) EncodeQueries

func (r *Route) EncodeQueries(ignore_lone_id bool) map[string]interface{}

func (*Route) Get

func (r *Route) Get() string

func (*Route) Got

func (r *Route) Got() int

type Sentence

type Sentence struct {
	Noun, Verb, Redundant string
}

func NewSentence

func NewSentence(r *Route, speaker iface.Speaker) (*Sentence, error)

The construction of a sentence consists of analyzing parts of the route with the help of a speaker, who can recognize nouns, and verbs related to that noun.

Rethink later: there can be a certain ambivalence in the way the nouns (subjects) determine the location for a verb. Eg (retard example): /users/posts/whatevers/delete-everything => The verb "DeleteEverything" is not related only to "whatevers", but rather it is a standalone method acting on arguments...

type URLEncoder

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

func NewURLEncoder

func NewURLEncoder(r *Route, s *Sentence) *URLEncoder

func (*URLEncoder) Form

func (u *URLEncoder) Form(action_name string) *Form

func (*URLEncoder) Url

func (u *URLEncoder) Url(action_name string, input_params map[string]interface{}) (string, map[string]interface{})

func (*URLEncoder) UrlString

func (u *URLEncoder) UrlString(action_name string, input_params map[string]interface{}) string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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