Nix 2.26.3
Nix, the purely functional package manager; unstable internal interfaces
 
Loading...
Searching...
No Matches
attrs.hh File Reference
#include "types.hh"
#include "hash.hh"
#include <variant>
#include <nlohmann/json_fwd.hpp>
#include <optional>

Go to the source code of this file.

Typedefs

typedef std::variant< std::string, uint64_t, Explicit< bool > > nix::fetchers::Attr
 
typedef std::map< std::string, Attr > nix::fetchers::Attrs
 

Functions

Attrs nix::fetchers::jsonToAttrs (const nlohmann::json &json)
 
nlohmann::json nix::fetchers::attrsToJSON (const Attrs &attrs)
 
std::optional< std::string > nix::fetchers::maybeGetStrAttr (const Attrs &attrs, const std::string &name)
 
std::string nix::fetchers::getStrAttr (const Attrs &attrs, const std::string &name)
 
std::optional< uint64_t > nix::fetchers::maybeGetIntAttr (const Attrs &attrs, const std::string &name)
 
uint64_t nix::fetchers::getIntAttr (const Attrs &attrs, const std::string &name)
 
std::optional< bool > nix::fetchers::maybeGetBoolAttr (const Attrs &attrs, const std::string &name)
 
bool nix::fetchers::getBoolAttr (const Attrs &attrs, const std::string &name)
 
std::map< std::string, std::string > nix::fetchers::attrsToQuery (const Attrs &attrs)
 
Hash nix::fetchers::getRevAttr (const Attrs &attrs, const std::string &name)
 

Typedef Documentation

◆ Attrs

typedef std::map<std::string, Attr> nix::fetchers::Attrs

An Attrs can be thought of a JSON object restricted or simplified to be "flat", not containing any subcontainers (arrays or objects) and also not containing any nulls.