Liking cljdoc? Tell your friends :D

com.walmartlabs.lacinia.resolve

Complex results for field resolver functions.

Resolver functions may return a value directly, or may wrap a value with a modifier (with-error or with-context).

A value or wrapped value may be returned asynchronously using a ResolverResultPromise.

The FieldResolver protocol allows a Clojure record to act as a field resolver function.

Complex results for field resolver functions.

Resolver functions may return a value directly, or may wrap a value with
a modifier ([[with-error]] or [[with-context]]).

A value or wrapped value may be returned asynchronously using a [[ResolverResultPromise]].

The [[FieldResolver]] protocol allows a Clojure record to act as a field resolver function.
raw docstring

*callback-executor*clj

If non-nil, then specifies a java.util.concurrent.Executor (typically, a thread pool of some form) used to invoke callbacks when ResolveResultPromises are delivered.

If non-nil, then specifies a java.util.concurrent.Executor (typically, a thread pool of some form) used to invoke callbacks
when ResolveResultPromises are delivered.
raw docstring

as-resolver-fnclj

(as-resolver-fn field-resolver)

Wraps a FieldResolver instance as a field resolver function.

If the field-resolver provided is a function, it is returned unchanged.

Wraps a [[FieldResolver]] instance as a field resolver function.

If the field-resolver provided is a function, it is returned unchanged.
raw docstring

FieldResolvercljprotocol

Allows a Clojure record to operate as a field resolver.

Allows a Clojure record to operate as a field resolver.

resolve-valueclj

(resolve-value this context args value)

The analog of a field resolver function, this method is passed the instance, and the standard context, field arguments, and container value, and returns a resolved value.

The analog of a field resolver function, this method is passed the instance, and the standard
context, field arguments, and container value, and returns a resolved value.
raw docstring

is-resolver-result?clj

(is-resolver-result? value)

Is the provided value actually a ResolverResult?

Is the provided value actually a [[ResolverResult]]?
raw docstring

resolve-asclj

(resolve-as resolved-value)
(resolve-as resolved-value resolver-errors)

Invoked by field resolvers to wrap a simple return value as a ResolverResult.

The two-arguments version is a convienience around using with-error.

This is an immediately realized ResolverResult.

Use resolve-promise and [[deliver!]] for an asynchronous result.

When [[on-deliver!]] is invoked, the provided callback is immediately invoked (in the same thread).

Invoked by field resolvers to wrap a simple return value as a ResolverResult.

The two-arguments version is a convienience around using [[with-error]].

This is an immediately realized ResolverResult.

Use [[resolve-promise]] and [[deliver!]] for an asynchronous result.

When [[on-deliver!]] is invoked, the provided callback is immediately invoked (in the same thread).
raw docstring

resolve-promiseclj

(resolve-promise)

Returns a ResolverResultPromise.

A value must be resolved and ultimately provided via [[deliver!]].

Returns a [[ResolverResultPromise]].

A value must be resolved and ultimately provided via [[deliver!]].
raw docstring

ResolverResultcljprotocol

A special type returned from a field resolver that can contain a resolved value and/or errors.

A special type returned from a field resolver that can contain a resolved value
and/or errors.

on-deliver!clj

(on-deliver! this callback)

Provides a callback that is invoked immediately after the ResolverResult is realized. The callback is passed the ResolverResult's value.

on-deliver! should only be invoked once. It returns this.

On a simple ResolverResult (not a ResolverResultPromise), the callback is invoked immediately.

For a ResolverResultPromise, the callback may be invoked on another thread.

The callback is invoked for side-effects; its result is ignored.

Provides a callback that is invoked immediately after the ResolverResult is realized.
The callback is passed the ResolverResult's value.

`on-deliver!` should only be invoked once.
It returns `this`.

On a simple ResolverResult (not a ResolverResultPromise), the callback is invoked
immediately.

For a [[ResolverResultPromise]], the callback may be invoked on another thread.

The callback is invoked for side-effects; its result is ignored.
raw docstring

ResolverResultPromisecljprotocol

A specialization of ResolverResult that supports asynchronous delivery of the resolved value and errors.

A specialization of ResolverResult that supports asynchronous delivery of the resolved value and errors.

deliver!clj

(deliver! this value)
(deliver! this value errors)

Invoked to realize the ResolverResult, triggering the callback to receive the value and errors.

The callback is invoked in the current thread, unless [[thread-pool]] is non-nil, in which case the callback is invoked in a pooled thread.

The two arguments version is simply a convienience around the with-error modifier.

Returns this.

Invoked to realize the ResolverResult, triggering the callback to receive the value and errors.

The callback is invoked in the current thread, unless [[*thread-pool*]] is non-nil, in which case
the callback is invoked in a pooled thread.

The two arguments version is simply a convienience around the [[with-error]] modifier.

Returns `this`.
raw docstring

with-contextclj

(with-context value context-map)

Wraps a value so that when nested fields (at any depth) are executed, the provided values will be in the context.

The provided context-map is merged onto the application context.

Wraps a value so that when nested fields (at any depth) are executed, the provided values will be in the context.

The provided context-map is merged onto the application context.
raw docstring

with-errorclj

(with-error value error)

Wraps a value, modifiying it to include an error map (or seq of error maps).

Wraps a value, modifiying it to include an error map (or seq of error maps).
raw docstring

wrap-resolver-resultclj

(wrap-resolver-result resolver wrapper-fn)

Wraps a resolver function or (FieldResolver instance), passing the result through a wrapper function.

The wrapper function is passed four values: the context, arguments, and value as passed to the resolver, then the resolved value from the resolver.

wrap-resolver-result understands resolver functions that return either a ResolverResult or a bare value, as well as functions that wrapped with the with-error or with-context modifier.

The wrapper-fn is passed the underlying value and must return a new value. The new value will be re-wrapped with modifiers as necessary.

The wrapped value may itself be a ResolverResult, and the value (either plain, or inside a ResolverResult) may also be decorated using with-error or with-context.

Wraps a resolver function or ([[FieldResolver]] instance), passing the result through a wrapper function.

The wrapper function is passed four values:  the context, arguments, and value
as passed to the resolver, then the resolved value from the
resolver.

`wrap-resolver-result` understands resolver functions that return either a [[ResolverResult]]
or a bare value, as well as functions that wrapped with the [[with-error]] or
[[with-context]] modifier.

The wrapper-fn is passed the underlying value and must return a new value.
The new value will be re-wrapped with modifiers as necessary.

The wrapped value may itself be a ResolverResult, and the
value (either plain, or inside a ResolverResult) may also be decorated
using `with-error` or `with-context`.
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close