Documentation

TypeDB.Value

TypeDB values #

Lean representations of TypeDB 3 value types that keep every value exact: Decimal (TypeDB's 19-digit fixed point), Duration (months, days and nanoseconds, which do not normalise into each other), DatetimeTZ (an instant plus the zone it was written in) and IID.

Value and Concept are the raw shapes the native layer produces. Their constructor order and field order are mirrored by ffi/typedb_lean.c; change both together.

structure TypeDB.Decimal :

An exact decimal integer + fractional · 10⁻¹⁹ with fractional < 10¹⁹, TypeDB's representation. Negative values have a negative integer and a non-negative fractional, so -1.5 is ⟨-2, 5 · 10¹⁸⟩.

Instances For
    def TypeDB.instDecidableEqDecimal.decEq (x✝ x✝¹ : Decimal) :
    Decidable (x✝ = x✝¹)
    Equations
    Instances For
      Equations
      • One or more equations did not get rendered due to their size.
      Instances For
        Equations
        Instances For

          10¹⁹, the number of fractional units in one.

          Equations
          Instances For

            The value multiplied by 10¹⁹, as an integer.

            Equations
            Instances For

              The decimal n · 10⁻¹⁹; the integer part wraps around if it does not fit in Int64.

              Equations
              Instances For
                @[instance_reducible]
                Equations
                @[instance_reducible]
                Equations
                @[instance_reducible]
                Equations
                @[instance_reducible]
                Equations
                @[instance_reducible]
                Equations
                @[instance_reducible]
                Equations
                @[instance_reducible]
                Equations
                @[instance_reducible]
                Equations

                Plain decimal notation with no trailing zeros, e.g. -1.5, 3.0.

                Equations
                • One or more equations did not get rendered due to their size.
                Instances For

                  Parses [-]digits[.digits][dec] with at most 19 fractional digits.

                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For

                    A TypeDB duration. Months, days and nanoseconds are kept apart because their lengths vary: a month is not a fixed number of days and a day is not always 24 hours.

                    Instances For
                      def TypeDB.instDecidableEqDuration.decEq (x✝ x✝¹ : Duration) :
                      Decidable (x✝ = x✝¹)
                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For
                        Equations
                        • One or more equations did not get rendered due to their size.
                        Instances For
                          Equations
                          Instances For

                            ISO 8601 notation, as TypeQL writes duration literals: P1Y2M3DT4H5M6.5S.

                            Equations
                            • One or more equations did not get rendered due to their size.
                            Instances For
                              inductive TypeDB.Zone :

                              How a datetime-tz names its zone.

                              • iana (name : String) : Zone

                                An IANA zone such as Europe/London.

                              • fixed (offsetSeconds : Int32) : Zone

                                A fixed offset from UTC, in seconds.

                              Instances For
                                @[instance_reducible]
                                Equations
                                Equations
                                • One or more equations did not get rendered due to their size.
                                Instances For

                                  A TypeDB datetime-tz: the instant (UTC seconds and nanoseconds since the Unix epoch), the zone it is expressed in, and the zone's UTC offset at that instant. The offset is what lets the value be printed back as local time without loading zone rules.

                                  Instances For
                                    Equations
                                    • One or more equations did not get rendered due to their size.
                                    Instances For
                                      Equations
                                      • One or more equations did not get rendered due to their size.
                                      Instances For
                                        structure TypeDB.IID :

                                        An instance identifier, as TypeDB prints it (0x1e00…).

                                        Instances For
                                          def TypeDB.instDecidableEqIID.decEq (x✝ x✝¹ : IID) :
                                          Decidable (x✝ = x✝¹)
                                          Equations
                                          Instances For
                                            @[instance_reducible]
                                            Equations
                                            Equations
                                            Instances For
                                              @[instance_reducible]
                                              Equations
                                              @[instance_reducible]
                                              Equations
                                              inductive TypeDB.Value :

                                              A value as the native layer reports it. Constructor and field order are mirrored by ffi/typedb_lean.c.

                                              Instances For
                                                @[instance_reducible]
                                                Equations
                                                Equations
                                                • One or more equations did not get rendered due to their size.
                                                Instances For
                                                  @[instance_reducible]
                                                  Equations

                                                  The TypeDB name of the value's type, used in decode errors.

                                                  Equations
                                                  Instances For
                                                    inductive TypeDB.Concept :

                                                    A concept in an answer row. Constructor and field order are mirrored by ffi/typedb_lean.c. Fields the decoder did not ask for (see Plan) are left as empty strings.

                                                    Instances For
                                                      Equations
                                                      • One or more equations did not get rendered due to their size.
                                                      Instances For

                                                        The value of an attribute or value concept.

                                                        Equations
                                                        Instances For

                                                          The IID of an entity or relation.

                                                          Equations
                                                          Instances For

                                                            A short description used in decode errors.

                                                            Equations
                                                            Instances For

                                                              Conversions to and from Std.Time #

                                                              UTC seconds and sub-second nanoseconds of a timestamp.

                                                              Equations
                                                              Instances For

                                                                The value as a Std.Time.DateTime whose zone is fixed at the value's offset. The instant and local time are exact; date arithmetic across a DST change needs toDateTimeWithRules.

                                                                Equations
                                                                • One or more equations did not get rendered due to their size.
                                                                Instances For

                                                                  The value as a Std.Time.DateTime with the full rules of its IANA zone.

                                                                  Equations
                                                                  • One or more equations did not get rendered due to their size.
                                                                  Instances For

                                                                    The instant of a Std.Time.DateTime, at its current offset. Pass iana to keep the zone's name, e.g. Europe/London; otherwise the value carries a fixed offset.

                                                                    Equations
                                                                    • One or more equations did not get rendered due to their size.
                                                                    Instances For

                                                                      A local time in an IANA zone, resolved with the zone's rules.

                                                                      Equations
                                                                      Instances For

                                                                        A local time at a fixed UTC offset in seconds.

                                                                        Equations
                                                                        • One or more equations did not get rendered due to their size.
                                                                        Instances For