Documentation

Hale.Hasql.Hasql.Encoders

structure Hasql.Encoders.Params (α : Type) :

A parameter encoder converts a typed value to an array of SQL parameter strings.

Instances For

    Encode no parameters.

    Equations
    Instances For

      Encode a non-nullable text parameter.

      Equations
      Instances For

        Encode a non-nullable integer parameter.

        Equations
        Instances For

          Encode a non-nullable natural number parameter.

          Equations
          Instances For

            Encode a non-nullable float parameter.

            Equations
            Instances For

              Encode a non-nullable boolean parameter.

              Equations
              Instances For

                Make any encoder nullable. none encodes as SQL NULL.

                Equations
                Instances For
                  def Hasql.Encoders.Params.contramap {β α : Type} (f : βα) (enc : Params α) :

                  Contramap the input of an encoder.

                  Equations
                  Instances For
                    def Hasql.Encoders.Params.pair {α β : Type} (ea : Params α) (eb : Params β) :
                    Params (α × β)

                    Combine two encoders for a pair.

                    Equations
                    Instances For
                      def Hasql.Encoders.Params.triple {α β γ : Type} (ea : Params α) (eb : Params β) (ec : Params γ) :
                      Params (α × β × γ)

                      Combine three encoders for a triple.

                      Equations
                      Instances For

                        Encode a value using its ToString instance.

                        Equations
                        Instances For

                          none encoder has width 0.

                          text encoder has width 1.

                          int encoder has width 1.

                          nat encoder has width 1.

                          bool encoder has width 1.

                          theorem Hasql.Encoders.Params.nullable_width {α : Type} (inner : Params α) :
                          inner.nullable.width = inner.width

                          nullable preserves width.

                          theorem Hasql.Encoders.Params.contramap_width {β α : Type} (f : βα) (enc : Params α) :
                          (contramap f enc).width = enc.width

                          contramap preserves width.

                          theorem Hasql.Encoders.Params.pair_width {α β : Type} (ea : Params α) (eb : Params β) :
                          (ea.pair eb).width = ea.width + eb.width

                          pair width is the sum of its constituents' widths.

                          theorem Hasql.Encoders.Params.triple_width {α β γ : Type} (ea : Params α) (eb : Params β) (ec : Params γ) :
                          (ea.triple eb ec).width = ea.width + eb.width + ec.width

                          triple width is the sum of all three widths.