Documentation ¶
Index ¶
- Constants
- func Handle(writer http.ResponseWriter, req *http.Request)
- func Help() (msg string)
- func IsValidHTTPMethod(method *string) (valid bool)
- func MakeMagicEndpoint(magic *Magic) endpoint.Endpoint
- func MakeRequest(req *Request, response *Response) (err error)
- type Call
- type Dependency
- type Magic
- type MagicService
- type Middleware
- type PassThruData
- type Request
- type Response
- type Result
- type Workload
Constants ¶
View Source
const DefaultTimeout = 10 * time.Second
Variables ¶
This section is empty.
Functions ¶
func Handle ¶
func Handle(writer http.ResponseWriter, req *http.Request)
Handle function is entry point for all http request.
func IsValidHTTPMethod ¶
utility method to validate the HTTP method someone desires to use.
func MakeMagicEndpoint ¶
MakeMagicEndpoint creates go-kit endpoint function
func MakeRequest ¶
* we expect a valid url. GET requests support name value pairs. * Data will always go in the body of the request. It's more for backward compatability * since I know of services that combine request data with query strings.
Types ¶
type Dependency ¶
type Dependency struct {
Request Request `json:"request"`
}
what if we could allow call dependencies? b depends on the result data of a, that sort of thing.
type MagicService ¶
type PassThruData ¶
type PassThruData struct {
Data []interface{}
}
a utility structure to pass one or more results to a request
type Request ¶
type Request struct { Id string `json:"id"` // some way to identify this request in the response URL string `json:"url"` // the restful api to call Method string `json:"method"` // request method: get/put/post/delete Data string `json:"data"` // data to pass to api. if it's a get, we add ? to URL Header http.Header `json:"headers"` // request specific headers to add Dependents []Dependency `json:"dependency"` // id of the request this request depends on UseData bool `json:"useData"` // if so, Payload is sprintf-able UseDepHeader bool `json:"useDepHeader"` // if you want to use the headers from dependent calls DepHeader []string `json:"DepHeaders"` // name the headers to use. DoJoin bool `json:"doJoin"` // you plan on passing multiple dependencies and need to join the results JoinChar string `json:"joinChar"` // e.g. , or | PassByName string `json:"passName"` // if it's not json, it parameterized and needs a name }
our definition of a request i'm not sure if i should have ContentType or assume it's in the headers
type Workload ¶
type Workload struct { Requests []Request `json:"requests"` StrictOrder bool `json:"strictorder"` // sync or async Timeout int64 `json:"timeout"` // TODO add a real timeout for the sync process UseHeaders bool `json:"use_headers"` // set this to true if the requests should use the headers of the work request // contains filtered or unexported fields }
Click to show internal directories.
Click to hide internal directories.