#lang scheme/base
(require scheme/contract
scheme/list
"base.ss"
"era/era.ss")
(define schema null)
(define (schema-entities)
schema)
(define (schema-entity name)
(findf (lambda (entity)
(eq? (entity-name entity) name))
schema))
(define (add-schema-entity! entity)
(if (schema-entity (entity-name entity))
(raise-exn exn:fail:snooze
(format "Entity already exists in schema: ~a" (entity-name entity)))
(set! schema (cons entity schema))))
(provide/contract
[schema-entities (-> (listof entity?))]
[schema-entity (-> symbol? (or/c entity? false/c))]
[add-schema-entity! (-> entity? void?)])