MCPcopy Create free account
hub / github.com/dagger/dagger / loadWorkspaceArg

Method loadWorkspaceArg

core/modfunc.go:1257–1283  ·  view source on GitHub ↗

loadWorkspaceArg loads a workspace argument by resolving it through the currentWorkspace query. The workspace is automatically injected into module functions that declare a Workspace parameter.

(
	ctx context.Context,
	dag *dagql.Server,
)

Source from the content-addressed store, hash-verified

1255// currentWorkspace query. The workspace is automatically injected into
1256// module functions that declare a Workspace parameter.
1257func (fn *ModuleFunction) loadWorkspaceArg(
1258 ctx context.Context,
1259 dag *dagql.Server,
1260) (dagql.IDType, error) {
1261 if dag == nil {
1262 return nil, fmt.Errorf("dagql server is nil but required for workspace argument")
1263 }
1264
1265 var ws dagql.ObjectResult[*Workspace]
1266 err := dag.Select(ctx, dag.Root(), &ws,
1267 dagql.Selector{
1268 Field: "currentWorkspace",
1269 Args: []dagql.NamedInput{
1270 {Name: "skipMigrationCheck", Value: dagql.Boolean(true)},
1271 },
1272 },
1273 )
1274 if err != nil {
1275 return nil, fmt.Errorf("load workspace: %w", err)
1276 }
1277
1278 wsID, err := ws.ID()
1279 if err != nil {
1280 return nil, fmt.Errorf("get workspace ID: %w", err)
1281 }
1282 return dagql.NewID[*Workspace](wsID), nil
1283}
1284
1285func (fn *ModuleFunction) applyIgnoreOnDir(ctx context.Context, dag *dagql.Server, arg *FunctionArg, value any) (any, error) {
1286 if kind := arg.TypeDef.Self().Kind; kind != TypeDefKindObject {

Callers 1

DynamicInputsForCallMethod · 0.95

Calls 4

BooleanTypeAlias · 0.92
SelectMethod · 0.65
IDMethod · 0.65
RootMethod · 0.45

Tested by

no test coverage detected