FieldMetadata.@chainMacro

Chain together any macros. Useful for combining @metadata macros.

Example

@chain columns @label @units @default_kw

@columns struct Foo
  bar::Int | 7 | u"g" | "grams of bar"
end
FieldMetadata.@metadataMacro
@metadata name default [type=Any]

Generate a macro that constructs methods of the same name. These methods return the metadata information provided for each field of the struct.

If no method is definjed for a type or field, the default value is used. If a type is passed to the macro, the type of metadata will be checked when it is loaded with the method. The default type is Any.

@metadata def_range (0, 0) Tuple
@def_range struct Model
    a::Int | (1, 4)
    b::Int | (4, 9)
end

model = Model(3, 5)
def_range(model, Val{:a})
(1, 4)

def_range(model)
((1, 4), (4, 9))