envie/schema
Types
pub type Field(a) {
Field(
meta: FieldMeta,
run: fn() -> Result(a, error.Error),
trace: fn() -> InspectField,
)
}
Constructors
-
Field( meta: FieldMeta, run: fn() -> Result(a, error.Error), trace: fn() -> InspectField, )
pub type FieldMeta {
FieldMeta(
name: String,
optional: Bool,
has_default: Bool,
secret: Bool,
)
}
Constructors
-
FieldMeta( name: String, optional: Bool, has_default: Bool, secret: Bool, )
pub type InspectField {
InspectField(
name: String,
value: option.Option(String),
used_default: Bool,
optional: Bool,
secret: Bool,
error: option.Option(error.Error),
)
}
Constructors
-
InspectField( name: String, value: option.Option(String), used_default: Bool, optional: Bool, secret: Bool, error: option.Option(error.Error), )
pub type Schema(a) {
Schema(
fields: List(FieldMeta),
run: fn() -> Result(a, error.Error),
trace: fn() -> List(InspectField),
)
}
Constructors
-
Schema( fields: List(FieldMeta), run: fn() -> Result(a, error.Error), trace: fn() -> List(InspectField), )
Values
pub fn build3(
first: Field(a),
second: Field(b),
third: Field(c),
build: fn(a, b, c) -> d,
) -> Schema(d)
pub fn field(
name: String,
decoder: decode.Decoder(a),
) -> Field(a)
pub fn inspect_fields(schema: Schema(a)) -> List(InspectField)
pub fn load(schema: Schema(a)) -> Result(a, error.Error)
pub fn load_field(field: Field(a)) -> Result(a, error.Error)
pub fn optional(field: Field(a)) -> Field(option.Option(a))