preql-core v1.0.0-beta-rc5
PreQL
- Author: Jonathan M. Wilbur [jonathan@wilbur.space](mailto:jonathan@wilbur.space)
- Copyright Year: 2019
- License: MIT License
What is PreQL?
A Pre-SQL language for schema that can transpile to any SQL dialect. It uses a declarative Kubernetes-like YAML schema and generates the necessary commands or statements in the correct order to generate schema and other database objects in the database dialect of your choice. It also enables you to label your schema and interact with it programmatically, which is harder to do with traditional DBMS-specific schema.
Build
- Clone the repository.
- Install the necessary components by running
npm installin the root directory. - Build by running
npm run buildin the root directory.
Usage
This library is not useful alone. It is meant to be included in other programs that transpile PreQL into DBMS-specific DDL. Generally speaking, such a program will want to do the following:
- Call
validateObjectfor each object. This just validates the object against schema. - Call
indexObjectson the array of validated objects. This produces a "database" that the next function will use. - Call
validateNamespacefor each namespace produced byindexObjects. This performs more semantic validation, such as checking that foreign-key constraints are satisfied across objects, and ensuring thatAttributes belong to aStructthat actually exists.
There are several functions provided by this library in source/Commands that
are also exposed as Serverless functions that provide Core PreQL functionality.
Most of the documentation of this library is in the form of JSDoc comments and the TypeScript types.
For documentation of the individual API Object kinds, drill into
source/APIObjectKinds, where you will find JSON schema, TypeScript interfaces,
and JSDoc comments. It may be quicker to view the test data at
test/data/kubey.yaml. The many Jest tests in test/jest may also be
instructive.
Possible Future Features
- PreQL Log (In-database log of errors, warnings, etc.)
ReplicationSetkindVirtualAttributekindShardkindSequencekindEventkindHASHsetter, or something else for hashing. (This would be really useful for secure password storage.)CONCATsetter (Check if string begins or ends with something, and CONCAT if not present.)Add information about error codes inI don't know how to do this.getPreqlInfo.- Add
Promiseresolution and rejection value documentation when this issue is closed. - Handle support or non-support for Unicode Characters
- Errors indicating when you are passing in the wrong datatype for non-Typescript use.
- Write a command for testing data types.
- JSONSchema titles and descriptions
- Document target requirements.
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
7 years ago
7 years ago