Libraries¶
A Go library returns a *runtime.Library.
func Library() *runtime.Library {
return &runtime.Library{
Name: "files",
Description: "File resources.",
Resources: map[string]runtime.ResourceRegistration{
"file": runtime.MakeResource[File, *FileOutput, runtime.NoConfig](),
},
}
}
The main fields are:
NameandDescriptionfor human-readable metadata.Configurationfor an optional library configuration schema.Resources,DataSources, andActionsfor primitive node types.Functionsfor inline expression functions.ResourceComposites,DataComposites, andActionCompositesfor generated UB libraries.
The compiler assigns the resolved library path. Library authors register the types; factory source chooses the import alias.
Configuration can be declared inline or returned by another package's
LibraryConfiguration() function. Split packages let service packages share one
configuration schema while factories still import each service package by its
own path.
A factory imports the library and calls a registered type with alias.type: