Documentation ¶
Index ¶
- Constants
- Variables
- type AsBody
- type Base64
- type Body
- type CacheControl
- type Chain
- type Debugging
- type Details
- type DoneResource
- type DoneResources
- type EnvSource
- type ErrQueryRevisionDeprecated
- type Flatten
- type Function
- type HTTPClient
- type HTTPRequest
- type HTTPResponse
- type Headers
- type JSON
- type Match
- type Modifiers
- type NoMultiplex
- type Params
- type Query
- type ResourceCacheControl
- type ResourceCacheControlValue
- type ResourceID
- type Resources
- type Statement
- type Variable
Constants ¶
const ( FromMethod string = "from" ToMethod = "to" IntoMethod = "into" UpdateMethod = "update" DeleteMethod = "delete" )
Methods available to be used in query statements.
Variables ¶
var ErrRequestTimeout = errors.New("request timed out")
ErrRequestTimeout is the error returned by HTTPClient when a HTTP call fails due to the request exceeding the timeout defined in HTTPRequest.
Functions ¶
This section is empty.
Types ¶
type AsBody ¶
type AsBody struct {
Value interface{}
}
AsBody is a Function that define a `with` parameter as the request body for statements using to, into or patch methods.
type Base64 ¶
type Base64 struct {
Value interface{}
}
Base64 is a Function that encode the target value as base64.
type CacheControl ¶
type CacheControl struct { MaxAge interface{} SMaxAge interface{} }
CacheControl is the internal representation of the `max-age` and `s-max-age` clauses.
type Chain ¶
type Chain []interface{}
Chain is the internal representation of a chain parameter value.
type Debugging ¶
type Debugging struct { Method string Url string RequestHeaders map[string]string ResponseHeaders map[string]string Params map[string]interface{} RequestBody interface{} ResponseTime int64 }
Debugging represents the collection of information about the statement result. This is only used when the client enable it during query execution.
type Details ¶
type Details struct { Status int Success bool IgnoreErrors bool CacheControl ResourceCacheControl Debug *Debugging }
Details represents metadata about the statement result.
type DoneResource ¶
type DoneResource struct { Status int Success bool IgnoreErrors bool CacheControl ResourceCacheControl Method string URL string RequestParams map[string]interface{} RequestHeaders map[string]string RequestBody interface{} ResponseHeaders map[string]string ResponseBody interface{} ResponseTime int64 }
DoneResource represents a statement result.
type DoneResources ¶
type DoneResources []interface{}
DoneResources represents a multiplexed statement result.
type ErrQueryRevisionDeprecated ¶
type ErrQueryRevisionDeprecated struct {
Revision int
}
ErrQueryRevisionDeprecated represents an error from fetching a query marked as deprecated.
func (ErrQueryRevisionDeprecated) Error ¶
func (e ErrQueryRevisionDeprecated) Error() string
type Flatten ¶
type Flatten struct {
Value interface{}
}
Flatten is a Function that encode the target value as a plain list of value.
type Function ¶
type Function interface { Target() interface{} Map(fn func(target interface{}) interface{}) Function }
Function is the interface implemented by types that provide encoding, filters and special behaviour through the apply operator.
Target returns the value upon which the function will be applied. Map uses a function to transform the target value preserving the current Function type wrapping it.
type HTTPClient ¶
type HTTPClient interface {
Do(ctx context.Context, request HTTPRequest) (HTTPResponse, error)
}
HTTPClient is the interface that wrap the method Do
Do takes an HTTPRequest and execute it respecting the cancellation signal from the given Context.
type HTTPRequest ¶
type HTTPRequest struct { Method string Schema string Host string Path string Query map[string]interface{} Body Body Headers Headers Timeout time.Duration }
HTTPRequest describe a HTTP call to be made by HTTPClient.
type HTTPResponse ¶
type HTTPResponse struct { URL string StatusCode int Body Body Headers Headers Duration time.Duration }
HTTPResponse describe a HTTP response returned by HTTPClient.
type JSON ¶
type JSON struct {
Value interface{}
}
JSON is a Function that encode the target value as json.
type Match ¶
type Match struct { Value interface{} Arg interface{} }
Match is a Function that select values from the statement result based on the given Arg.
type Modifiers ¶
type Modifiers map[string]interface{}
Modifiers is the internal representation of the `use` clause.
type NoMultiplex ¶
type NoMultiplex struct {
Value interface{}
}
NoMultiplex is a Function that disable request multiplexing of statements with list parameters.
func (NoMultiplex) Map ¶
func (nm NoMultiplex) Map(fn func(target interface{}) interface{}) Function
Map apply the given function to the Target value preserving the NoMultiplex as wrapper.
func (NoMultiplex) Target ¶
func (nm NoMultiplex) Target() interface{}
Target return the value upon which NoMultiplex will be applied.
type Params ¶
type Params struct { Body interface{} Values map[string]interface{} }
Params is the internal representation of the `with` clause.
type ResourceCacheControl ¶
type ResourceCacheControl struct { NoCache bool MaxAge ResourceCacheControlValue SMaxAge ResourceCacheControlValue }
ResourceCacheControl represent cache control directives returned by upstream during statement resolution.
type ResourceCacheControlValue ¶
ResourceCacheControlValue represents the values a cache control directive is able to have. It can either be present and have a integer time value or not be present in the upstream response.
type ResourceID ¶
type ResourceID string
ResourceID is an unique identifier used by a statement. If an alias is present, it is used. Otherwise, the resource name.
func NewResourceID ¶
func NewResourceID(statement Statement) ResourceID
NewResourceID make a ResourceID from a Statement.
type Resources ¶
type Resources map[ResourceID]interface{}
Resources represents the index of statements already resolved or to be resolved.
func NewResources ¶
NewResources constructs a Resources collection from a slice of statements.