dagger/dsl/type_def

Types

pub type Opts {
  Opts(
    description: option.Option(String),
    source_map: option.Option(types.SourceMap),
    value: option.Option(String),
    deprecated: option.Option(String),
  )
}

Constructors

Values

pub fn as_enum(parent: types.TypeDef) -> types.EnumTypeDef

If kind is ENUM, the enum-specific type definition. If kind is not ENUM, this will be null.

pub fn as_input(parent: types.TypeDef) -> types.InputTypeDef

If kind is INPUT, the input-specific type definition. If kind is not INPUT, this will be null.

pub fn as_interface(
  parent: types.TypeDef,
) -> types.InterfaceTypeDef

If kind is INTERFACE, the interface-specific type definition. If kind is not INTERFACE, this will be null.

pub fn as_list(parent: types.TypeDef) -> types.ListTypeDef

If kind is LIST, the list-specific type definition. If kind is not LIST, this will be null.

pub fn as_object(parent: types.TypeDef) -> types.ObjectTypeDef

If kind is OBJECT, the object-specific type definition. If kind is not OBJECT, this will be null.

pub fn as_scalar(parent: types.TypeDef) -> types.ScalarTypeDef

If kind is SCALAR, the scalar-specific type definition. If kind is not SCALAR, this will be null.

pub fn deprecated(opts: Opts, val: String) -> Opts
pub fn description(opts: Opts, val: String) -> Opts
pub fn id(parent: types.TypeDef) -> types.TypeDef

A unique identifier for this TypeDef.

pub fn kind(
  parent: types.TypeDef,
  client client: types.Client,
  then handler: fn(Result(types.TypeDefKind, types.QueryError)) -> a,
) -> a

The kind of type this is (e.g. primitive, list, object).

pub fn none(opts: Opts) -> Opts
pub fn optional(
  parent: types.TypeDef,
  client client: types.Client,
  then handler: fn(Result(Bool, types.QueryError)) -> a,
) -> a

Whether this type can be set to null. Defaults to false.

pub fn source_map(opts: Opts, val: types.SourceMap) -> Opts
pub fn type_def() -> types.TypeDef
pub fn value(opts: Opts, val: String) -> Opts
pub fn with_constructor(
  parent: types.TypeDef,
  function function: types.Function,
) -> types.TypeDef

Adds a function for constructing a new instance of an Object TypeDef, failing if the type is not an object.

pub fn with_enum(
  parent: types.TypeDef,
  name name: String,
  with with_fn: fn(Opts) -> Opts,
) -> types.TypeDef

Returns a TypeDef of kind Enum with the provided name. Note that an enum’s values may be omitted if the intent is only to refer to an enum. This is how functions are able to return their own, or any other circular reference.

pub fn with_enum_member(
  parent: types.TypeDef,
  name name: String,
  with with_fn: fn(Opts) -> Opts,
) -> types.TypeDef

Adds a static value for an Enum TypeDef, failing if the type is not an enum.

pub fn with_field(
  parent: types.TypeDef,
  name name: String,
  type_def type_def: types.TypeDef,
  with with_fn: fn(Opts) -> Opts,
) -> types.TypeDef

Adds a static field for an Object TypeDef, failing if the type is not an object.

pub fn with_function(
  parent: types.TypeDef,
  function function: types.Function,
) -> types.TypeDef

Adds a function for an Object or Interface TypeDef, failing if the type is not one of those kinds.

pub fn with_interface(
  parent: types.TypeDef,
  name name: String,
  with with_fn: fn(Opts) -> Opts,
) -> types.TypeDef

Returns a TypeDef of kind Interface with the provided name.

pub fn with_kind(
  parent: types.TypeDef,
  kind kind: types.TypeDefKind,
) -> types.TypeDef

Sets the kind of the type.

pub fn with_list_of(
  parent: types.TypeDef,
  element_type element_type: types.TypeDef,
) -> types.TypeDef

Returns a TypeDef of kind List with the provided type for its elements.

pub fn with_object(
  parent: types.TypeDef,
  name name: String,
  with with_fn: fn(Opts) -> Opts,
) -> types.TypeDef

Returns a TypeDef of kind Object with the provided name. Note that an object’s fields and functions may be omitted if the intent is only to refer to an object. This is how functions are able to return their own object, or any other circular reference.

pub fn with_optional(
  parent: types.TypeDef,
  optional optional: Bool,
) -> types.TypeDef

Sets whether this type can be set to null.

pub fn with_scalar(
  parent: types.TypeDef,
  name name: String,
  with with_fn: fn(Opts) -> Opts,
) -> types.TypeDef

Returns a TypeDef of kind Scalar with the provided name.

Search Document