Nix 2.26.3
Nix, the purely functional package manager; unstable internal interfaces
 
Loading...
Searching...
No Matches
attrs.hh
Go to the documentation of this file.
1#pragma once
3
4#include "types.hh"
5#include "hash.hh"
6
7#include <variant>
8
9#include <nlohmann/json_fwd.hpp>
10
11#include <optional>
12
13namespace nix::fetchers {
14
15typedef std::variant<std::string, uint64_t, Explicit<bool>> Attr;
16
22typedef std::map<std::string, Attr> Attrs;
23
24Attrs jsonToAttrs(const nlohmann::json & json);
25
26nlohmann::json attrsToJSON(const Attrs & attrs);
27
28std::optional<std::string> maybeGetStrAttr(const Attrs & attrs, const std::string & name);
29
30std::string getStrAttr(const Attrs & attrs, const std::string & name);
31
32std::optional<uint64_t> maybeGetIntAttr(const Attrs & attrs, const std::string & name);
33
34uint64_t getIntAttr(const Attrs & attrs, const std::string & name);
35
36std::optional<bool> maybeGetBoolAttr(const Attrs & attrs, const std::string & name);
37
38bool getBoolAttr(const Attrs & attrs, const std::string & name);
39
40std::map<std::string, std::string> attrsToQuery(const Attrs & attrs);
41
42Hash getRevAttr(const Attrs & attrs, const std::string & name);
43
44}
std::map< std::string, Attr > Attrs
Definition attrs.hh:22
const std::string_view & name
Definition lexer.l:1709
Definition hash.hh:45