package postgres_async

  1. Overview
  2. Docs

Source file types.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
open Core
open! Int.Replace_polymorphic_compare

type backend_key =
  { pid : int
  ; secret : int
  }
[@@deriving sexp_of]

module type Named_or_unnamed = sig
  type t

  val unnamed : t
  val create_named_exn : string -> t
  val to_string : t -> string
end

module Named_or_unnamed = struct
  type t = string

  let unnamed = ""

  let create_named_exn s =
    if String.is_empty s
    then failwith "Named_or_unnamed.create_named_exn got an empty string";
    if String.mem s '\x00'
    then failwith "Named_or_unnamed.create_named_exn: string must not contain \\x00";
    s
  ;;

  let to_string (t : t) : string = t
end

module Statement_name = Named_or_unnamed
module Portal_name = Named_or_unnamed
module Notification_channel = String