diff options
| author | Marcos Magueta <maguetamarcos@gmail.com> | 2026-03-07 12:19:12 -0300 |
|---|---|---|
| committer | Marcos Magueta <maguetamarcos@gmail.com> | 2026-03-07 12:19:12 -0300 |
| commit | 0e2e04e2545b53254c5cb8e031cacd212e7a427d (patch) | |
| tree | 3a78e86516b88635d3eb40a944ac89ea2b25b01c /lib/manipulation.ml | |
| parent | e9bc4aa3fa0e775acf1978722da1fde1ed8a469d (diff) | |
| download | Sakura-0e2e04e2545b53254c5cb8e031cacd212e7a427d.tar.gz Sakura-0e2e04e2545b53254c5cb8e031cacd212e7a427d.zip | |
domains
Diffstat (limited to 'lib/manipulation.ml')
| -rw-r--r-- | lib/manipulation.ml | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/lib/manipulation.ml b/lib/manipulation.ml index 50722a8..283641a 100644 --- a/lib/manipulation.ml +++ b/lib/manipulation.ml @@ -150,6 +150,7 @@ module Make (Storage : Management.Physical.S) = struct name = stored.name; tree; relations; + domains = Management.Database.RelationMap.empty; history = stored.history; timestamp = stored.timestamp; }) @@ -158,12 +159,19 @@ module Make (Storage : Management.Physical.S) = struct Database Operations ============================================================================ *) - (** Create a new database with standard domain relations *) + (** Register a domain in the database. Can be called after [create_database] + to add user-defined domains (e.g. [money], [email], [uuid]). *) + let register_domain (db : Management.Database.t) (domain : Domain.t) + : Management.Database.t = + Management.Database.add_domain db domain + + (** Create a new database pre-seeded with the standard prelude domains. *) let create_database ~name : Management.Database.t = - let db = Management.Database.empty ~name in - (* Add standard domain relations: integer, natural, string, etc. *) - (* For now, just return empty database. Prelude can be added later. *) - db + let seed domains db = + List.fold_left Management.Database.add_domain db domains + in + Management.Database.empty ~name + |> seed Prelude.Domains.[integer; natural; rational; string] (** Get database history *) let database_history (db : Management.Database.t) : Conventions.Hash.t list = |
