mappings

package
v0.0.0-...-8740a4e Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2015 License: MIT Imports: 8 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheStrategy

type CacheStrategy struct {
	Key     string
	Seconds int
}

type CompiledMapping

type CompiledMapping struct {
	Mapping           *Mapping
	CompiledBody      *template.Template
	CompiledUrl       *template.Template
	CompiledTransform *template.Template
	CompiledCacheKey  *template.Template
	CompiledMapping   map[string][]*regexp.Regexp
}

func (*CompiledMapping) Body

func (cm *CompiledMapping) Body(data map[string]interface{}) (string, error)

func (*CompiledMapping) Prepare

func (cm *CompiledMapping) Prepare(data map[string]interface{}) (*RequestMapping, error)

func (*CompiledMapping) Uri

func (cm *CompiledMapping) Uri(data map[string]interface{}) (string, error)

type Mapping

type Mapping struct {
	Id      string
	Target  *TargetMapping
	Mapping map[string][]string
	Caching *CacheStrategy
}

func (*Mapping) Compile

func (q *Mapping) Compile() (*CompiledMapping, error)

type Mappings

type Mappings []*CompiledMapping

func Load

func Load(config map[string]interface{}) (*Mappings, error)

func (*Mappings) DeRegister

func (list *Mappings) DeRegister(ids []string)

func (*Mappings) Get

func (list *Mappings) Get() *Mappings

func (Mappings) GetMatch

func (m Mappings) GetMatch(complexData map[string]interface{}) (*RequestMapping, error)

func (*Mappings) Register

func (list *Mappings) Register(config map[string]interface{}) ([]string, error)

type RequestMapping

type RequestMapping struct {
	Id                string
	Body              string
	Headers           map[string]string
	Verb              string
	Uri               string
	Mapping           *Mapping
	CompiledTransform *template.Template
	Data              *map[string]interface{}
	CacheKey          string
	RequestStream     io.ReadCloser
}

type TargetMapping

type TargetMapping struct {
	Headers   map[string]string
	Verb      string
	Body      string
	Uri       string
	Stub      bool
	Transform *TargetTransform
}

type TargetTransform

type TargetTransform struct {
	Type     string
	Regexp   *regexp.Regexp
	Template string
	Headers  map[string]string
}

Jump to

Keyboard shortcuts

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