Module Sqlgg.SqlSource

Sourcetype pos = int * int
Sourcetype 'a located = {
  1. value : 'a;
  2. pos : pos;
}
Sourceval make_located : value:'a -> pos:pos -> 'a located
Sourcetype 'a collated = {
  1. collated : 'a;
  2. collation : string located option;
}
Sourceval make_collated : collated:'a -> ?collation:??? -> unit -> 'a collated
Sourceval dummy_pos : pos
Sourceval dummy_loc : 'a -> 'a located
Sourcemodule Type : sig ... end
Sourcemodule Constraint : sig ... end
Sourcemodule Constraints : sig ... end
Sourcemodule Meta : sig ... end
Sourcetype attr = {
  1. name : string;
  2. domain : Type.t;
  3. extra : Constraints.t;
  4. meta : Meta.t;
}
Sourceval unique_keys : attr list -> Constraint.StringSet.t list
Sourceval make_attribute : string -> Type.kind option -> Constraints.t -> meta:(Meta.StringMap.key * string) list -> attr
Sourceval unnamed_attribute : ?meta:??? -> Type.t -> attr
Sourceval make_attribute' : ?extra:??? -> ?meta:??? -> string -> Type.t -> attr
Sourcemodule Schema : sig ... end
Sourcetype table_name = {
  1. db : string option;
  2. tn : string;
}
Sourceval show_table_name : table_name -> string
Sourceval make_table_name : ?db:??? -> string -> table_name
Sourcetype schema = Schema.t
Sourcetype table = table_name * schema
Sourcetype join_source = {
  1. table : table_name;
  2. alias : table_name option;
}
Sourceval join_source_name : join_source -> table_name
Sourceval print_table : 'a IO.output -> (table_name * attr list) -> unit
Sourcetype param_id = string option located

optional name and start/end position in string

Sourcetype shared_query_ref_id = string located
Sourceval show_shared_query_ref_id : shared_query_ref_id -> Ppx_deriving_runtime.string
Sourcetype int_size =
  1. | Tiny
  2. | Small
  3. | Medium
  4. | Big
Sourcetype lob_size =
  1. | Tiny
  2. | Medium
  3. | Long
Sourcetype signedness =
  1. | Signed
  2. | Unsigned
Sourcetype float_precision =
  1. | Single
  2. | Double
Sourcemodule Source_type : sig ... end
Sourcetype 't param = {
  1. id : param_id;
  2. typ : 't;
}
Sourceval make_param : id:param_id -> typ:'a -> 'a param
Sourcetype option_actions_kind =
  1. | BoolChoices
  2. | SetDefault
Sourceval show_option_actions_kind : option_actions_kind -> Ppx_deriving_runtime.string
Sourcetype params = Type.t param list
Sourcetype in_or_not_in = [
  1. | `In
  2. | `NotIn
]
Sourcetype ctor =
  1. | Simple of param_id * var list option
  2. | Verbatim of string * string
Sourceand var =
  1. | Single of Type.t param * Meta.t
  2. | SingleIn of Type.t param * Meta.t
  3. | ChoiceIn of {
    1. param : param_id;
    2. kind : in_or_not_in;
    3. vars : var list;
    }
  4. | Choice of param_id * ctor list
  5. | DynamicSelect of param_id * ctor list
  6. | DynamicSelectJoin of {
    1. pid : param_id;
    2. pos : pos;
    3. source : join_source;
    }
  7. | TupleList of param_id * tuple_list_kind
  8. | OptionActionChoice of param_id * var list * pos * pos * option_actions_kind
  9. | SharedVarsGroup of vars * shared_query_ref_id
Sourceand tuple_list_kind =
  1. | Insertion of schema
  2. | Where_in of ((Type.t * Meta.t) list * in_or_not_in) located
  3. | ValueRows of {
    1. types : Type.t list;
    2. values_start_pos : int;
    }
Sourceand vars = var list
Sourceval ctor_vars : ctor -> var list
Sourceval sub_vars : var -> vars
Sourceval map_sub_vars : (vars -> vars) -> var -> var
Sourceval var_pos : var -> int
Sourcetype alter_pos = [
  1. | `After of string
  2. | `Default
  3. | `First
]
Sourcetype direction = [
  1. | `Fixed
  2. | `Param of param_id
]
Sourcetype cte_supported_compound_op = [
  1. | `Union
  2. | `Union_all
]
Sourceval show_cte_supported_compound_op : cte_supported_compound_op -> Ppx_deriving_runtime.string
Sourcetype compound_op = [
  1. | cte_supported_compound_op
  2. | `Except
  3. | `Intersect
]
Sourcetype int_or_param = [
  1. | `Const of int
  2. | `Limit of Source_type.t param
]
Sourcetype limit_t = [
  1. | `Limit
  2. | `Offset
]
Sourcetype col_name = {
  1. cname : string;
    (*

    column name

    *)
  2. tname : table_name option;
}
Sourcetype logical_op =
  1. | And
  2. | Or
  3. | Xor
Sourcetype comparison_op =
  1. | Comp_equal
  2. | Comp_num_cmp
  3. | Comp_num_eq
  4. | Not_distinct_op
  5. | Is_null
  6. | Is_not_null
Sourcetype null_handling_fn_kind =
  1. | Coalesce of Type.tyvar * Type.tyvar
  2. | Null_if
  3. | If_null
Sourceval show_null_handling_fn_kind : null_handling_fn_kind -> Ppx_deriving_runtime.string
Sourcetype source_alias = {
  1. table_name : table_name;
  2. column_aliases : schema option;
}
Sourcetype select_row_locking_kind =
  1. | For_update
  2. | For_share
Sourceand limit = Source_type.t param list * bool
Sourceand source_kind = [
  1. | `Select of select_full
  2. | `Table of table_name
  3. | `Nested of nested
  4. | `ValueRows of row_values
]
Sourceand source = source_kind * source_alias option
Sourceand join_condition = expr Schema.Join.condition
Sourceand select = {
  1. columns : column list;
  2. from : nested option;
  3. where : expr option;
  4. group : expr list;
  5. having : expr option;
}
Sourceand cte_item = {
  1. cte_name : string;
  2. cols : schema option;
  3. stmt : cte_stmt;
}
Sourceand cte_stmt =
  1. | CteInline of select_complete
  2. | CteSharedQuery of shared_query_ref_id
Sourceand cte = {
  1. cte_items : cte_item list;
  2. is_recursive : bool;
}
Sourceand select_complete = {
  1. select : select * (compound_op * select) list;
  2. order : order;
  3. limit : limit option;
  4. select_row_locking : select_row_locking_kind located option;
}
Sourceand select_full = {
  1. select_complete : select_complete;
  2. cte : cte option;
}
Sourceand row_constructor_list =
  1. | RowExprList of expr list list
  2. | RowParam of {
    1. id : param_id;
    2. types : Source_type.t list;
    3. values_start_pos : int;
    }
Sourceand row_values = {
  1. row_constructor_list : row_constructor_list;
  2. row_order : order;
  3. row_limit : limit option;
}
Sourceand order = (expr * direction option) list
Sourceand agg_with_order_kind =
  1. | Group_concat
  2. | Json_arrayagg
Sourceand agg_fun =
  1. | Self
  2. | Count
  3. | Avg
  4. | With_order of {
    1. with_order_kind : agg_with_order_kind;
    2. order : order;
    }
Sourceand 't func =
  1. | Agg of agg_fun
  2. | Null_handling of null_handling_fn_kind
  3. | Comparison of comparison_op
  4. | Logical of logical_op
  5. | Negation
  6. | Ret of 't
  7. | F of Type.tyvar * Type.tyvar list
  8. | Col_assign of {
    1. ret_t : Type.tyvar;
    2. col_t : Type.tyvar;
    3. arg_t : Type.tyvar;
    }
  9. | Multi of {
    1. ret : Type.tyvar;
    2. fixed_args : Type.tyvar list;
    3. repeating_pattern : Type.tyvar list;
    }
Sourceand 'expr choices = (param_id * 'expr option) list
Sourceand 't fun_ = {
  1. fn_name : string;
  2. kind : 't func;
  3. parameters : expr list;
  4. is_over_clause : bool;
}
Sourceand case_branch = {
  1. when_ : expr;
  2. then_ : expr;
}
Sourceand case = {
  1. case : expr option;
  2. branches : case_branch list;
  3. else_ : expr option;
}
Sourceand in_tuple_list = {
  1. exprs : expr list;
  2. param_id : param_id;
  3. kind_in_tuple_list : in_or_not_in;
}
Sourceand expr =
  1. | Value of Type.t collated
    (*

    literal value

    *)
  2. | Param of Source_type.t param * Meta.t
  3. | Inparam of Source_type.t param * Meta.t
  4. | Choices of param_id * expr choices
  5. | InChoice of param_id * in_or_not_in * expr
  6. | Fun of Source_type.t fun_
  7. | SelectExpr of select_full * [ `AsValue | `Exists ]
  8. | Column of col_name collated
  9. | InTupleList of in_tuple_list located
  10. | OptionActions of {
    1. choice : expr;
    2. pos : pos * pos;
    3. kind : option_actions_kind;
    }
  11. | Case of case
  12. | Of_values of string
    (*

    VALUES(col_name)

    *)
Sourceand column_kind =
  1. | All
  2. | AllOf of table_name
  3. | Expr of expr located * string option
Sourceval show_select_row_locking_kind : select_row_locking_kind -> Ppx_deriving_runtime.string
Sourceval show_row_constructor_list : row_constructor_list -> Ppx_deriving_runtime.string
Sourceval show_agg_with_order_kind : agg_with_order_kind -> Ppx_deriving_runtime.string
Sourcetype columns = column list
Sourceval source_fun_kind_to_infer : Source_type.t func -> Type.t func
Sourceval expr_to_string : expr -> Ppx_deriving_runtime.string
Sourceval sub_exprs : expr -> expr list
Sourceval map_sub_exprs : (expr -> expr) -> expr -> expr
Sourceval expr_exists : (expr -> bool) -> expr -> bool
Sourceval make_partition_by : expr list -> unit
Sourcetype assignment_expr =
  1. | RegularExpr of expr
  2. | AssignDefault
  3. | WithDefaultParam of expr * pos * pos
Sourcetype assignments = (col_name * assignment_expr) list
Sourcetype on_conflict =
  1. | Do_update of assignments
  2. | Do_nothing
Sourcetype conflict_clause =
  1. | On_duplicate of {
    1. assignments : assignments;
    }
  2. | On_conflict of {
    1. action : on_conflict;
    2. attrs : col_name list;
    }
Sourcetype insert_action_kind =
  1. | Insert_into
  2. | Replace_into of pos
Sourceval show_insert_action_kind : insert_action_kind -> Ppx_deriving_runtime.string
Sourcetype insert_action = {
  1. insert_action_kind : insert_action_kind;
  2. target : table_name;
  3. action : [ `Set of assignments option | `Values of string list option * assignment_expr list list option | `Param of string list option * param_id | `Select of string list option * select_full ];
  4. on_conflict_clause : conflict_clause located option;
}
Sourcetype table_constraints = [
  1. | `Ignore
  2. | `Primary of string list
  3. | `Unique of string option * string list
]
Sourcetype index_kind =
  1. | Regular_idx
  2. | Fulltext
  3. | Spatial
Sourcemodule Alter_action_attr : sig ... end
Sourcetype index_op_kind =
  1. | Plain_idx
  2. | Unique_idx
  3. | Fulltext_idx
  4. | Spatial_idx
Sourcetype table_inline_index = {
  1. idx_kind : index_kind;
  2. idx_name : string option;
  3. idx_cols : string list;
  4. idx_unique : bool;
}
Sourceval show_table_inline_index : table_inline_index -> Ppx_deriving_runtime.string
Sourcetype add_index = {
  1. add_idx_name : string option;
  2. add_idx_kind : index_op_kind;
  3. add_idx_cols : string list;
}
Sourcetype create_index_def = {
  1. ci_name : string;
  2. ci_table : table_name;
  3. ci_cols : string collated list;
  4. ci_kind : index_op_kind;
}
Sourcetype create_target_schema = {
  1. schema : Alter_action_attr.t list;
  2. constraints : table_constraints list;
  3. indexes : table_inline_index located list;
}
Sourceval show_create_target_schema : create_target_schema -> Ppx_deriving_runtime.string
Sourcetype create_target =
  1. | Schema of create_target_schema
  2. | Select of select_full located
Sourcetype charset_name =
  1. | Named of string
  2. | Binary
  3. | Ascii
  4. | Unicode
Sourcetype ttl_option = [
  1. | `TtlSet of string * int * string
  2. | `TtlEnable of string
]
Sourcemodule Alter_column_pg : sig ... end
Sourcetype alter_action = [
  1. | `Add of Alter_action_attr.t * alter_pos
  2. | `RenameTable of table_name
  3. | `RenameColumn of string * string
  4. | `RenameIndex of string * string
  5. | `Drop of string
  6. | `Change of string * Alter_action_attr.t * alter_pos
  7. | `AddIndex of add_index
  8. | `DropIndex of string
  9. | `AddPrimaryKey of string list
  10. | `DropPrimaryKey
  11. | `AddConstraint of string option
  12. | `DropConstraint of string
  13. | `Default_or_convert_to of charset_name * string located option
  14. | `TtlOptions of ttl_option list * pos
  15. | `RemoveTtl of pos
  16. | `AlterColumnPG of string * Alter_column_pg.t located
]
Sourcetype create_type_target =
  1. | TypeEnum of string list
Sourceval show_create_type_target : create_type_target -> Ppx_deriving_runtime.string
Sourcetype stmt =
  1. | Create of table_name * create_target
  2. | Drop of table_name
  3. | Alter of table_name * alter_action list
  4. | Rename of (table_name * table_name) list
  5. | CreateIndex of create_index_def
  6. | Insert of insert_action
  7. | Delete of table_name * expr option
  8. | DeleteMulti of table_name list * nested * expr option
  9. | Set of (string * expr) list * stmt option
  10. | Update of table_name * assignments * expr option * order * Source_type.t param list
  11. | UpdateMulti of nested list * assignments * expr option * order * Source_type.t param list
  12. | Select of select_full
  13. | CreateRoutine of table_name * Source_type.kind collated located option * (string * Source_type.kind collated located * expr option) list
  14. | CreateType of string * create_type_target
  15. | DropType of string * bool
Sourcetype 'attr dynamic_field = {
  1. field_id : param_id;
  2. field_attr : 'attr;
  3. join_deps : int list;
}
Sourcetype schema_column_with_sources =
  1. | AttrWithSources of table_name Schema.Source.Attr.t
  2. | DynamicWithSources of param_id * table_name Schema.Source.Attr.t dynamic_field list
Sourceval show_schema_column_with_sources : schema_column_with_sources -> Ppx_deriving_runtime.string
Sourcetype schema_column =
  1. | Attr of attr
  2. | Dynamic of param_id * attr dynamic_field list
Sourceval monomorphic : Type.t -> Type.t list -> 'a func
Sourceval fixed : Type.kind -> Type.kind list -> 'a func
Sourceval fun_identity : 'a func
Sourceval pp_func : Format.formatter -> Type.t func -> unit
Sourceval string_of_func : Type.t func -> string
Sourceval is_grouping : 'a func -> bool
Sourcemodule Function : sig ... end