pub struct Query {
pub proc: Option<Arc<DaggerSessionProc>>,
pub selection: Selection,
pub graphql_client: DynGraphQLClient,
}
Fields§
§proc: Option<Arc<DaggerSessionProc>>
§selection: Selection
§graphql_client: DynGraphQLClient
Implementations§
Source§impl Query
impl Query
Sourcepub fn address(&self, value: impl Into<String>) -> Address
pub fn address(&self, value: impl Into<String>) -> Address
initialize an address to load directories, containers, secrets or other object types.
Sourcepub fn cache_volume(&self, key: impl Into<String>) -> CacheVolume
pub fn cache_volume(&self, key: impl Into<String>) -> CacheVolume
Constructs a cache volume for a given cache key.
§Arguments
key
- A string identifier to target this cache volume (e.g., “modules-cache”).
Sourcepub fn container(&self) -> Container
pub fn container(&self) -> Container
Creates a scratch container, with no image or metadata. To pull an image, follow up with the “from” function.
§Arguments
opt
- optional argument, see inner type for documentation, use_opts to use
Sourcepub fn container_opts(&self, opts: QueryContainerOpts) -> Container
pub fn container_opts(&self, opts: QueryContainerOpts) -> Container
Creates a scratch container, with no image or metadata. To pull an image, follow up with the “from” function.
§Arguments
opt
- optional argument, see inner type for documentation, use_opts to use
Sourcepub fn current_env(&self) -> Env
pub fn current_env(&self) -> Env
Returns the current environment When called from a function invoked via an LLM tool call, this will be the LLM’s current environment, including any modifications made through calling tools. Env values returned by functions become the new environment for subsequent calls, and Changeset values returned by functions are applied to the environment’s workspace. When called from a module function outside of an LLM, this returns an Env with the current module installed, and with the current module’s source directory as its workspace.
Sourcepub fn current_function_call(&self) -> FunctionCall
pub fn current_function_call(&self) -> FunctionCall
The FunctionCall context that the SDK caller is currently executing in. If the caller is not currently executing in a function, this will return an error.
Sourcepub fn current_module(&self) -> CurrentModule
pub fn current_module(&self) -> CurrentModule
The module currently being served in the session, if any.
Sourcepub fn current_type_defs(&self) -> Vec<TypeDef>
pub fn current_type_defs(&self) -> Vec<TypeDef>
The TypeDef representations of the objects currently being served in the session.
Sourcepub async fn default_platform(&self) -> Result<Platform, DaggerError>
pub async fn default_platform(&self) -> Result<Platform, DaggerError>
The default platform of the engine.
Sourcepub fn env(&self) -> Env
pub fn env(&self) -> Env
Initializes a new environment
§Arguments
opt
- optional argument, see inner type for documentation, use_opts to use
Sourcepub fn env_opts(&self, opts: QueryEnvOpts) -> Env
pub fn env_opts(&self, opts: QueryEnvOpts) -> Env
Initializes a new environment
§Arguments
opt
- optional argument, see inner type for documentation, use_opts to use
Sourcepub fn env_file(&self) -> EnvFile
pub fn env_file(&self) -> EnvFile
Initialize an environment file
§Arguments
opt
- optional argument, see inner type for documentation, use_opts to use
Sourcepub fn env_file_opts(&self, opts: QueryEnvFileOpts) -> EnvFile
pub fn env_file_opts(&self, opts: QueryEnvFileOpts) -> EnvFile
Initialize an environment file
§Arguments
opt
- optional argument, see inner type for documentation, use_opts to use
Sourcepub fn file(&self, name: impl Into<String>, contents: impl Into<String>) -> File
pub fn file(&self, name: impl Into<String>, contents: impl Into<String>) -> File
Creates a file with the specified contents.
§Arguments
name
- Name of the new file. Example: “foo.txt”contents
- Contents of the new file. Example: “Hello world!”opt
- optional argument, see inner type for documentation, use_opts to use
Sourcepub fn file_opts(
&self,
name: impl Into<String>,
contents: impl Into<String>,
opts: QueryFileOpts,
) -> File
pub fn file_opts( &self, name: impl Into<String>, contents: impl Into<String>, opts: QueryFileOpts, ) -> File
Creates a file with the specified contents.
§Arguments
name
- Name of the new file. Example: “foo.txt”contents
- Contents of the new file. Example: “Hello world!”opt
- optional argument, see inner type for documentation, use_opts to use
Sourcepub fn function(
&self,
name: impl Into<String>,
return_type: impl IntoID<TypeDefId>,
) -> Function
pub fn function( &self, name: impl Into<String>, return_type: impl IntoID<TypeDefId>, ) -> Function
Creates a function.
§Arguments
name
- Name of the function, in its original format from the implementation language.return_type
- Return type of the function.
Sourcepub fn generated_code(&self, code: impl IntoID<DirectoryId>) -> GeneratedCode
pub fn generated_code(&self, code: impl IntoID<DirectoryId>) -> GeneratedCode
Create a code generation result, given a directory containing the generated code.
Sourcepub fn git(&self, url: impl Into<String>) -> GitRepository
pub fn git(&self, url: impl Into<String>) -> GitRepository
Queries a Git repository.
§Arguments
url
- URL of the git repository.
Can be formatted as https://{host}/{owner}/{repo}
, git@{host}:{owner}/{repo}
.
Suffix “.git” is optional.
opt
- optional argument, see inner type for documentation, use_opts to use
Sourcepub fn git_opts<'a>(
&self,
url: impl Into<String>,
opts: QueryGitOpts<'a>,
) -> GitRepository
pub fn git_opts<'a>( &self, url: impl Into<String>, opts: QueryGitOpts<'a>, ) -> GitRepository
Queries a Git repository.
§Arguments
url
- URL of the git repository.
Can be formatted as https://{host}/{owner}/{repo}
, git@{host}:{owner}/{repo}
.
Suffix “.git” is optional.
opt
- optional argument, see inner type for documentation, use_opts to use
Sourcepub fn http(&self, url: impl Into<String>) -> File
pub fn http(&self, url: impl Into<String>) -> File
Returns a file containing an http remote url content.
§Arguments
url
- HTTP url to get the content from (e.g., “https://docs.dagger.io”).opt
- optional argument, see inner type for documentation, use_opts to use
Sourcepub fn http_opts<'a>(
&self,
url: impl Into<String>,
opts: QueryHttpOpts<'a>,
) -> File
pub fn http_opts<'a>( &self, url: impl Into<String>, opts: QueryHttpOpts<'a>, ) -> File
Returns a file containing an http remote url content.
§Arguments
url
- HTTP url to get the content from (e.g., “https://docs.dagger.io”).opt
- optional argument, see inner type for documentation, use_opts to use
Sourcepub fn llm(&self) -> Llm
pub fn llm(&self) -> Llm
Initialize a Large Language Model (LLM)
§Arguments
opt
- optional argument, see inner type for documentation, use_opts to use
Sourcepub fn llm_opts<'a>(&self, opts: QueryLlmOpts<'a>) -> Llm
pub fn llm_opts<'a>(&self, opts: QueryLlmOpts<'a>) -> Llm
Initialize a Large Language Model (LLM)
§Arguments
opt
- optional argument, see inner type for documentation, use_opts to use
Sourcepub fn load_address_from_id(&self, id: impl IntoID<AddressId>) -> Address
pub fn load_address_from_id(&self, id: impl IntoID<AddressId>) -> Address
Load a Address from its ID.
Sourcepub fn load_binding_from_id(&self, id: impl IntoID<BindingId>) -> Binding
pub fn load_binding_from_id(&self, id: impl IntoID<BindingId>) -> Binding
Load a Binding from its ID.
Sourcepub fn load_cache_volume_from_id(
&self,
id: impl IntoID<CacheVolumeId>,
) -> CacheVolume
pub fn load_cache_volume_from_id( &self, id: impl IntoID<CacheVolumeId>, ) -> CacheVolume
Load a CacheVolume from its ID.
Sourcepub fn load_changeset_from_id(&self, id: impl IntoID<ChangesetId>) -> Changeset
pub fn load_changeset_from_id(&self, id: impl IntoID<ChangesetId>) -> Changeset
Load a Changeset from its ID.
Sourcepub fn load_cloud_from_id(&self, id: impl IntoID<CloudId>) -> Cloud
pub fn load_cloud_from_id(&self, id: impl IntoID<CloudId>) -> Cloud
Load a Cloud from its ID.
Sourcepub fn load_container_from_id(&self, id: impl IntoID<ContainerId>) -> Container
pub fn load_container_from_id(&self, id: impl IntoID<ContainerId>) -> Container
Load a Container from its ID.
Sourcepub fn load_current_module_from_id(
&self,
id: impl IntoID<CurrentModuleId>,
) -> CurrentModule
pub fn load_current_module_from_id( &self, id: impl IntoID<CurrentModuleId>, ) -> CurrentModule
Load a CurrentModule from its ID.
Sourcepub fn load_directory_from_id(&self, id: impl IntoID<DirectoryId>) -> Directory
pub fn load_directory_from_id(&self, id: impl IntoID<DirectoryId>) -> Directory
Load a Directory from its ID.
Sourcepub fn load_engine_cache_entry_from_id(
&self,
id: impl IntoID<EngineCacheEntryId>,
) -> EngineCacheEntry
pub fn load_engine_cache_entry_from_id( &self, id: impl IntoID<EngineCacheEntryId>, ) -> EngineCacheEntry
Load a EngineCacheEntry from its ID.
Sourcepub fn load_engine_cache_entry_set_from_id(
&self,
id: impl IntoID<EngineCacheEntrySetId>,
) -> EngineCacheEntrySet
pub fn load_engine_cache_entry_set_from_id( &self, id: impl IntoID<EngineCacheEntrySetId>, ) -> EngineCacheEntrySet
Load a EngineCacheEntrySet from its ID.
Sourcepub fn load_engine_cache_from_id(
&self,
id: impl IntoID<EngineCacheId>,
) -> EngineCache
pub fn load_engine_cache_from_id( &self, id: impl IntoID<EngineCacheId>, ) -> EngineCache
Load a EngineCache from its ID.
Sourcepub fn load_engine_from_id(&self, id: impl IntoID<EngineId>) -> Engine
pub fn load_engine_from_id(&self, id: impl IntoID<EngineId>) -> Engine
Load a Engine from its ID.
Sourcepub fn load_enum_type_def_from_id(
&self,
id: impl IntoID<EnumTypeDefId>,
) -> EnumTypeDef
pub fn load_enum_type_def_from_id( &self, id: impl IntoID<EnumTypeDefId>, ) -> EnumTypeDef
Load a EnumTypeDef from its ID.
Sourcepub fn load_enum_value_type_def_from_id(
&self,
id: impl IntoID<EnumValueTypeDefId>,
) -> EnumValueTypeDef
pub fn load_enum_value_type_def_from_id( &self, id: impl IntoID<EnumValueTypeDefId>, ) -> EnumValueTypeDef
Load a EnumValueTypeDef from its ID.
Sourcepub fn load_env_file_from_id(&self, id: impl IntoID<EnvFileId>) -> EnvFile
pub fn load_env_file_from_id(&self, id: impl IntoID<EnvFileId>) -> EnvFile
Load a EnvFile from its ID.
Sourcepub fn load_env_from_id(&self, id: impl IntoID<EnvId>) -> Env
pub fn load_env_from_id(&self, id: impl IntoID<EnvId>) -> Env
Load a Env from its ID.
Sourcepub fn load_env_variable_from_id(
&self,
id: impl IntoID<EnvVariableId>,
) -> EnvVariable
pub fn load_env_variable_from_id( &self, id: impl IntoID<EnvVariableId>, ) -> EnvVariable
Load a EnvVariable from its ID.
Sourcepub fn load_error_from_id(&self, id: impl IntoID<ErrorId>) -> Error
pub fn load_error_from_id(&self, id: impl IntoID<ErrorId>) -> Error
Load a Error from its ID.
Sourcepub fn load_error_value_from_id(
&self,
id: impl IntoID<ErrorValueId>,
) -> ErrorValue
pub fn load_error_value_from_id( &self, id: impl IntoID<ErrorValueId>, ) -> ErrorValue
Load a ErrorValue from its ID.
Sourcepub fn load_field_type_def_from_id(
&self,
id: impl IntoID<FieldTypeDefId>,
) -> FieldTypeDef
pub fn load_field_type_def_from_id( &self, id: impl IntoID<FieldTypeDefId>, ) -> FieldTypeDef
Load a FieldTypeDef from its ID.
Sourcepub fn load_file_from_id(&self, id: impl IntoID<FileId>) -> File
pub fn load_file_from_id(&self, id: impl IntoID<FileId>) -> File
Load a File from its ID.
Sourcepub fn load_function_arg_from_id(
&self,
id: impl IntoID<FunctionArgId>,
) -> FunctionArg
pub fn load_function_arg_from_id( &self, id: impl IntoID<FunctionArgId>, ) -> FunctionArg
Load a FunctionArg from its ID.
Sourcepub fn load_function_call_arg_value_from_id(
&self,
id: impl IntoID<FunctionCallArgValueId>,
) -> FunctionCallArgValue
pub fn load_function_call_arg_value_from_id( &self, id: impl IntoID<FunctionCallArgValueId>, ) -> FunctionCallArgValue
Load a FunctionCallArgValue from its ID.
Sourcepub fn load_function_call_from_id(
&self,
id: impl IntoID<FunctionCallId>,
) -> FunctionCall
pub fn load_function_call_from_id( &self, id: impl IntoID<FunctionCallId>, ) -> FunctionCall
Load a FunctionCall from its ID.
Sourcepub fn load_function_from_id(&self, id: impl IntoID<FunctionId>) -> Function
pub fn load_function_from_id(&self, id: impl IntoID<FunctionId>) -> Function
Load a Function from its ID.
Sourcepub fn load_generated_code_from_id(
&self,
id: impl IntoID<GeneratedCodeId>,
) -> GeneratedCode
pub fn load_generated_code_from_id( &self, id: impl IntoID<GeneratedCodeId>, ) -> GeneratedCode
Load a GeneratedCode from its ID.
Sourcepub fn load_git_ref_from_id(&self, id: impl IntoID<GitRefId>) -> GitRef
pub fn load_git_ref_from_id(&self, id: impl IntoID<GitRefId>) -> GitRef
Load a GitRef from its ID.
Sourcepub fn load_git_repository_from_id(
&self,
id: impl IntoID<GitRepositoryId>,
) -> GitRepository
pub fn load_git_repository_from_id( &self, id: impl IntoID<GitRepositoryId>, ) -> GitRepository
Load a GitRepository from its ID.
Sourcepub fn load_host_from_id(&self, id: impl IntoID<HostId>) -> Host
pub fn load_host_from_id(&self, id: impl IntoID<HostId>) -> Host
Load a Host from its ID.
Sourcepub fn load_input_type_def_from_id(
&self,
id: impl IntoID<InputTypeDefId>,
) -> InputTypeDef
pub fn load_input_type_def_from_id( &self, id: impl IntoID<InputTypeDefId>, ) -> InputTypeDef
Load a InputTypeDef from its ID.
Sourcepub fn load_interface_type_def_from_id(
&self,
id: impl IntoID<InterfaceTypeDefId>,
) -> InterfaceTypeDef
pub fn load_interface_type_def_from_id( &self, id: impl IntoID<InterfaceTypeDefId>, ) -> InterfaceTypeDef
Load a InterfaceTypeDef from its ID.
Sourcepub fn load_json_value_from_id(&self, id: impl IntoID<JsonValueId>) -> JsonValue
pub fn load_json_value_from_id(&self, id: impl IntoID<JsonValueId>) -> JsonValue
Load a JSONValue from its ID.
Sourcepub fn load_llm_from_id(&self, id: impl IntoID<Llmid>) -> Llm
pub fn load_llm_from_id(&self, id: impl IntoID<Llmid>) -> Llm
Load a LLM from its ID.
Sourcepub fn load_llm_token_usage_from_id(
&self,
id: impl IntoID<LlmTokenUsageId>,
) -> LlmTokenUsage
pub fn load_llm_token_usage_from_id( &self, id: impl IntoID<LlmTokenUsageId>, ) -> LlmTokenUsage
Load a LLMTokenUsage from its ID.
Sourcepub fn load_label_from_id(&self, id: impl IntoID<LabelId>) -> Label
pub fn load_label_from_id(&self, id: impl IntoID<LabelId>) -> Label
Load a Label from its ID.
Sourcepub fn load_list_type_def_from_id(
&self,
id: impl IntoID<ListTypeDefId>,
) -> ListTypeDef
pub fn load_list_type_def_from_id( &self, id: impl IntoID<ListTypeDefId>, ) -> ListTypeDef
Load a ListTypeDef from its ID.
Sourcepub fn load_module_config_client_from_id(
&self,
id: impl IntoID<ModuleConfigClientId>,
) -> ModuleConfigClient
pub fn load_module_config_client_from_id( &self, id: impl IntoID<ModuleConfigClientId>, ) -> ModuleConfigClient
Load a ModuleConfigClient from its ID.
Sourcepub fn load_module_from_id(&self, id: impl IntoID<ModuleId>) -> Module
pub fn load_module_from_id(&self, id: impl IntoID<ModuleId>) -> Module
Load a Module from its ID.
Sourcepub fn load_module_source_from_id(
&self,
id: impl IntoID<ModuleSourceId>,
) -> ModuleSource
pub fn load_module_source_from_id( &self, id: impl IntoID<ModuleSourceId>, ) -> ModuleSource
Load a ModuleSource from its ID.
Sourcepub fn load_object_type_def_from_id(
&self,
id: impl IntoID<ObjectTypeDefId>,
) -> ObjectTypeDef
pub fn load_object_type_def_from_id( &self, id: impl IntoID<ObjectTypeDefId>, ) -> ObjectTypeDef
Load a ObjectTypeDef from its ID.
Sourcepub fn load_port_from_id(&self, id: impl IntoID<PortId>) -> Port
pub fn load_port_from_id(&self, id: impl IntoID<PortId>) -> Port
Load a Port from its ID.
Sourcepub fn load_sdk_config_from_id(&self, id: impl IntoID<SdkConfigId>) -> SdkConfig
pub fn load_sdk_config_from_id(&self, id: impl IntoID<SdkConfigId>) -> SdkConfig
Load a SDKConfig from its ID.
Sourcepub fn load_scalar_type_def_from_id(
&self,
id: impl IntoID<ScalarTypeDefId>,
) -> ScalarTypeDef
pub fn load_scalar_type_def_from_id( &self, id: impl IntoID<ScalarTypeDefId>, ) -> ScalarTypeDef
Load a ScalarTypeDef from its ID.
Sourcepub fn load_search_result_from_id(
&self,
id: impl IntoID<SearchResultId>,
) -> SearchResult
pub fn load_search_result_from_id( &self, id: impl IntoID<SearchResultId>, ) -> SearchResult
Load a SearchResult from its ID.
Sourcepub fn load_search_submatch_from_id(
&self,
id: impl IntoID<SearchSubmatchId>,
) -> SearchSubmatch
pub fn load_search_submatch_from_id( &self, id: impl IntoID<SearchSubmatchId>, ) -> SearchSubmatch
Load a SearchSubmatch from its ID.
Sourcepub fn load_secret_from_id(&self, id: impl IntoID<SecretId>) -> Secret
pub fn load_secret_from_id(&self, id: impl IntoID<SecretId>) -> Secret
Load a Secret from its ID.
Sourcepub fn load_service_from_id(&self, id: impl IntoID<ServiceId>) -> Service
pub fn load_service_from_id(&self, id: impl IntoID<ServiceId>) -> Service
Load a Service from its ID.
Sourcepub fn load_socket_from_id(&self, id: impl IntoID<SocketId>) -> Socket
pub fn load_socket_from_id(&self, id: impl IntoID<SocketId>) -> Socket
Load a Socket from its ID.
Sourcepub fn load_source_map_from_id(&self, id: impl IntoID<SourceMapId>) -> SourceMap
pub fn load_source_map_from_id(&self, id: impl IntoID<SourceMapId>) -> SourceMap
Load a SourceMap from its ID.
Sourcepub fn load_terminal_from_id(&self, id: impl IntoID<TerminalId>) -> Terminal
pub fn load_terminal_from_id(&self, id: impl IntoID<TerminalId>) -> Terminal
Load a Terminal from its ID.
Sourcepub fn load_type_def_from_id(&self, id: impl IntoID<TypeDefId>) -> TypeDef
pub fn load_type_def_from_id(&self, id: impl IntoID<TypeDefId>) -> TypeDef
Load a TypeDef from its ID.
Sourcepub fn module_source(&self, ref_string: impl Into<String>) -> ModuleSource
pub fn module_source(&self, ref_string: impl Into<String>) -> ModuleSource
Create a new module source instance from a source ref string
§Arguments
ref_string
- The string ref representation of the module sourceopt
- optional argument, see inner type for documentation, use_opts to use
Sourcepub fn module_source_opts<'a>(
&self,
ref_string: impl Into<String>,
opts: QueryModuleSourceOpts<'a>,
) -> ModuleSource
pub fn module_source_opts<'a>( &self, ref_string: impl Into<String>, opts: QueryModuleSourceOpts<'a>, ) -> ModuleSource
Create a new module source instance from a source ref string
§Arguments
ref_string
- The string ref representation of the module sourceopt
- optional argument, see inner type for documentation, use_opts to use
Sourcepub fn secret(&self, uri: impl Into<String>) -> Secret
pub fn secret(&self, uri: impl Into<String>) -> Secret
Creates a new secret.
§Arguments
uri
- The URI of the secret storeopt
- optional argument, see inner type for documentation, use_opts to use
Sourcepub fn secret_opts<'a>(
&self,
uri: impl Into<String>,
opts: QuerySecretOpts<'a>,
) -> Secret
pub fn secret_opts<'a>( &self, uri: impl Into<String>, opts: QuerySecretOpts<'a>, ) -> Secret
Creates a new secret.
§Arguments
uri
- The URI of the secret storeopt
- optional argument, see inner type for documentation, use_opts to use
Sourcepub fn set_secret(
&self,
name: impl Into<String>,
plaintext: impl Into<String>,
) -> Secret
pub fn set_secret( &self, name: impl Into<String>, plaintext: impl Into<String>, ) -> Secret
Sets a secret given a user defined name to its plaintext and returns the secret. The plaintext value is limited to a size of 128000 bytes.
§Arguments
name
- The user defined name for this secretplaintext
- The plaintext of the secret
Sourcepub fn source_map(
&self,
filename: impl Into<String>,
line: isize,
column: isize,
) -> SourceMap
pub fn source_map( &self, filename: impl Into<String>, line: isize, column: isize, ) -> SourceMap
Creates source map metadata.
§Arguments
filename
- The filename from the module source.line
- The line number within the filename.column
- The column number within the line.
Sourcepub async fn version(&self) -> Result<String, DaggerError>
pub async fn version(&self) -> Result<String, DaggerError>
Get the current Dagger Engine version.