Documentation
¶
Overview ¶
Package entrypoint holds the parts of module entrypoint loading that every entrypoint driver shares: resolving entrypoint.source to a module source, encoding the arguments of the ModuleEntrypoint interface, and turning the type definitions an entrypoint returns into a module.
The one driver lives next to it: dang evaluates the entrypoint source as a Dang program.
Index ¶
- Constants
- func FunctionArgsJSON(args []*core.FunctionCallArgValue) (core.JSON, error)
- func JSONCallArg(name string, value core.JSON) *core.FunctionCallArgValue
- func JSONScalarCallArg(name string, value core.JSON) *core.FunctionCallArgValue
- func ModuleFromTypeDefs(ctx context.Context, dag *dagql.Server, ...) (dagql.ObjectResult[*core.Module], error)
- func ResolveSource(ctx context.Context, dag *dagql.Server, ...) (dagql.ObjectResult[*core.ModuleSource], dagql.ObjectResult[*core.Workspace], ...)
- func StringCallArg(name, value string) *core.FunctionCallArgValue
- func ValidateConstructors(typeDefs dagql.ObjectResultArray[*core.TypeDef]) error
- func Workspace(ctx context.Context, dag *dagql.Server, ...) (dagql.ObjectResult[*core.Workspace], error)
- func WorkspaceCallArg(workspace dagql.ObjectResult[*core.Workspace]) (*core.FunctionCallArgValue, error)
Constants ¶
const TypeName = "ModuleEntrypoint"
TypeName is the interface an entrypoint must implement.
Variables ¶
This section is empty.
Functions ¶
func FunctionArgsJSON ¶
func FunctionArgsJSON(args []*core.FunctionCallArgValue) (core.JSON, error)
FunctionArgsJSON encodes call arguments as one JSON object, keyed by the original argument names.
func JSONCallArg ¶
func JSONCallArg(name string, value core.JSON) *core.FunctionCallArgValue
JSONCallArg builds an argument from an already encoded JSON value.
func JSONScalarCallArg ¶
func JSONScalarCallArg(name string, value core.JSON) *core.FunctionCallArgValue
JSONScalarCallArg builds a JSON scalar argument, which the call codec passes as a JSON-encoded string.
func ModuleFromTypeDefs ¶
func ModuleFromTypeDefs( ctx context.Context, dag *dagql.Server, typeDefs dagql.ObjectResultArray[*core.TypeDef], ) (dagql.ObjectResult[*core.Module], error)
ModuleFromTypeDefs builds a module from the types an entrypoint returned.
func ResolveSource ¶
func ResolveSource( ctx context.Context, dag *dagql.Server, src dagql.ObjectResult[*core.ModuleSource], ) (dagql.ObjectResult[*core.ModuleSource], dagql.ObjectResult[*core.Workspace], error)
ResolveSource resolves entrypoint.source to a module source for the entrypoint itself, and returns the workspace to pass to the entrypoint.
func StringCallArg ¶
func StringCallArg(name, value string) *core.FunctionCallArgValue
StringCallArg builds a JSON-encoded string argument.
func ValidateConstructors ¶
func ValidateConstructors(typeDefs dagql.ObjectResultArray[*core.TypeDef]) error
ValidateConstructors applies the engine's current limit of at most one object constructor per module.
func Workspace ¶
func Workspace( ctx context.Context, dag *dagql.Server, src dagql.ObjectResult[*core.ModuleSource], ) (dagql.ObjectResult[*core.Workspace], error)
Workspace returns the workspace to pass to a module entrypoint, with its working directory at the module's directory.
The engine already treats the workspace cwd as the module's scope when it hands a workspace to an SDK, so an entrypoint can find the module it serves through relative workspace paths, without a path generated into it. The root is unchanged: an entrypoint can still read above the module with an absolute workspace path.
A git or directory source keeps the caller's cwd, because its files are not in the workspace at all; they are in its context directory.
func WorkspaceCallArg ¶
func WorkspaceCallArg(workspace dagql.ObjectResult[*core.Workspace]) (*core.FunctionCallArgValue, error)
WorkspaceCallArg encodes the workspace argument shared by types and call.
Types ¶
This section is empty.