From 5b66828bd0e8db054de80bb72bfb6c86c81139a8 Mon Sep 17 00:00:00 2001 From: Pijus Kamandulis Date: Mon, 11 Mar 2024 20:47:44 +0200 Subject: [PATCH] Added some docs --- .github/ISSUE_TEMPLATE.md | 14 +++ .github/PULL_REQUEST_TEMPLATE.md | 18 +++ README.md | 2 +- docs/CODE_OF_CONDUCT.md | 125 +++++++++++++++++++ docs/COMPATIBILITY.md | 203 +++++++++++++++++++++++++++++++ docs/CONTRIBUTING.md | 37 ++++++ 6 files changed, 398 insertions(+), 1 deletion(-) create mode 100644 .github/ISSUE_TEMPLATE.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 docs/CODE_OF_CONDUCT.md create mode 100644 docs/COMPATIBILITY.md create mode 100644 docs/CONTRIBUTING.md diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..ca65d86 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,14 @@ +#### Summary +Bug report in one concise sentence + +#### Steps to reproduce +How can we reproduce the issue (what version are you using?) + +#### Expected behavior +Describe your issue in detail + +#### Observed behavior (that appears unintentional) +What did you see happen? Please include relevant error messages. + +#### Possible fixes +If you can, link to the line of code that might be responsible for the problem diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..1d2cc42 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,18 @@ + + +#### Summary + + +#### Ticket Link + diff --git a/README.md b/README.md index 3e6c45a..2788e01 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Cosmium -Cosmium is a lightweight Cosmos DB emulator designed to facilitate local development and testing. While it aims to provide developers with a solution for running a local database during development, it's important to note that it's not 100% compatible with Cosmos DB. However, it serves as a convenient tool for E2E or integration tests during the CI/CD pipeline. +Cosmium is a lightweight Cosmos DB emulator designed to facilitate local development and testing. While it aims to provide developers with a solution for running a local database during development, it's important to note that it's not 100% compatible with Cosmos DB. However, it serves as a convenient tool for E2E or integration tests during the CI/CD pipeline. Read more about compatibility [here](docs/compatibility.md). One of Cosmium's notable features is its ability to save and load state to a single JSON file. This feature makes it easy to load different test cases or share state with other developers, enhancing collaboration and efficiency in development workflows. diff --git a/docs/CODE_OF_CONDUCT.md b/docs/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..89adaa5 --- /dev/null +++ b/docs/CODE_OF_CONDUCT.md @@ -0,0 +1,125 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, caste, color, religion, or sexual +identity and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the overall + community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or advances of + any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email address, + without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official email address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at +cosmium@pikami.org. +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series of +actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or permanent +ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within the +community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.1, available at +[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1]. + +Community Impact Guidelines were inspired by +[Mozilla's code of conduct enforcement ladder][Mozilla CoC]. + +For answers to common questions about this code of conduct, see the FAQ at +[https://www.contributor-covenant.org/faq][FAQ]. diff --git a/docs/COMPATIBILITY.md b/docs/COMPATIBILITY.md new file mode 100644 index 0000000..b6173e3 --- /dev/null +++ b/docs/COMPATIBILITY.md @@ -0,0 +1,203 @@ +# Cosmium Compatibility with Cosmos DB + +## Introduction + +Cosmium is designed to emulate the functionality of Cosmos DB, providing developers with a local development environment that closely mimics the behavior of Cosmos DB. While Cosmium aims to be compatible with Cosmos DB, there are certain differences and limitations to be aware of. This document provides an overview of Cosmium's compatibility with Cosmos DB and highlights areas where deviations may occur. + +## Supported Features + +Cosmium strives to support the core features of Cosmos DB, including: + +- REST API +- SQL-like query language +- Document-based data model + +## Compatibility Matrix + +### Features +| Feature | Implemented | +|-------------------------------|-------------| +| Subqueries | No | +| Joins | No | +| Computed properties | No | +| Coalesce operators | No | +| Bitwise operators | No | +| GeoJSON location data | No | +| Parameterized queries | Yes | +| Stored procedures | No | +| Triggers | No | +| User-defined functions (UDFs) | No | + +### Clauses +| Clause | Implemented | +|--------------|-------------| +| SELECT | Yes | +| FROM | Yes | +| WHERE | Yes | +| ORDER BY | Yes | +| GROUP BY | Yes | +| OFFSET LIMIT | No | + +### Keywords +| Keyword | Implemented | +|----------|-------------| +| BETWEEN | No | +| DISTINCT | Yes | +| LIKE | No | +| IN | Yes | +| TOP | Yes | + +### Aggregate Functions +| Function | Implemented | +|----------|-------------| +| AVG | Yes | +| COUNT | Yes | +| MAX | Yes | +| MIN | Yes | +| SUM | Yes | + +### Array Functions +| Function | Implemented | +|----------------|-------------| +| ARRAY_CONCAT | Yes | +| ARRAY_CONTAINS | No | +| ARRAY_LENGTH | Yes | +| ARRAY_SLICE | Yes | +| CHOOSE | No | +| ObjectToArray | No | +| SetIntersect | Yes | +| SetUnion | Yes | + +### Conditional Functions +| Function | Implemented | +|----------|-------------| +| IIF | No | + +### Date and time Functions +| Function | Implemented | +|---------------------------|-------------| +| DateTimeAdd | No | +| DateTimeBin | No | +| DateTimeDiff | No | +| DateTimeFromParts | No | +| DateTimePart | No | +| DateTimeToTicks | No | +| DateTimeToTimestamp | No | +| GetCurrentDateTime | No | +| GetCurrentDateTimeStatic | No | +| GetCurrentTicks | No | +| GetCurrentTicksStatic | No | +| GetCurrentTimestamp | No | +| GetCurrentTimestampStatic | No | +| TicksToDateTime | No | +| TimestampToDateTime | No | + +### Item Functions +| Function | Implemented | +|------------|-------------| +| DocumentId | No | + +### Mathematical Functions +| Function | Implemented | +|------------------|-------------| +| ABS | No | +| ACOS | No | +| ASIN | No | +| ATAN | No | +| ATN2 | No | +| CEILING | No | +| COS | No | +| COT | No | +| DEGREES | No | +| EXP | No | +| FLOOR | No | +| IntAdd | No | +| IntBitAnd | No | +| IntBitLeftShift | No | +| IntBitNot | No | +| IntBitOr | No | +| IntBitRightShift | No | +| IntBitXor | No | +| IntDiv | No | +| IntMod | No | +| IntMul | No | +| IntSub | No | +| LOG | No | +| LOG10 | No | +| NumberBin | No | +| PI | No | +| POWER | No | +| RADIANS | No | +| RAND | No | +| ROUND | No | +| SIGN | No | +| SIN | No | +| SQRT | No | +| SQUARE | No | +| TAN | No | +| TRUNC | No | + +### Spatial Functions +| Function | Implemented | +|--------------------|-------------| +| ST_AREA | No | +| ST_DISTANCE | No | +| ST_WITHIN | No | +| ST_INTERSECTS | No | +| ST_ISVALID | No | +| ST_ISVALIDDETAILED | No | + +### String Functions +| Function | Implemented | +|-----------------|-------------| +| CONCAT | Yes | +| CONTAINS | Yes | +| ENDSWITH | Yes | +| INDEX_OF | Yes | +| LEFT | Yes | +| LENGTH | Yes | +| LOWER | Yes | +| LTRIM | Yes | +| REGEXMATCH | No | +| REPLACE | Yes | +| REPLICATE | Yes | +| REVERSE | Yes | +| RIGHT | Yes | +| RTRIM | Yes | +| STARTSWITH | Yes | +| STRINGEQUALS | Yes | +| StringToArray | No | +| StringToBoolean | No | +| StringToNull | No | +| StringToNumber | No | +| StringToObject | No | +| SUBSTRING | Yes | +| ToString | Yes | +| TRIM | Yes | +| UPPER | Yes | + +### Type checking Functions +| Function | Implemented | +|------------------|-------------| +| IS_ARRAY | Yes | +| IS_BOOL | Yes | +| IS_DEFINED | Yes | +| IS_FINITE_NUMBER | Yes | +| IS_INTEGER | Yes | +| IS_NULL | Yes | +| IS_NUMBER | Yes | +| IS_OBJECT | Yes | +| IS_PRIMITIVE | Yes | +| IS_STRING | Yes | + +## Known Differences + +While Cosmium aims to replicate the behavior of Cosmos DB as closely as possible, there are certain differences and limitations to be aware of: + +1. **Performance**: Cosmium may exhibit different performance characteristics compared to Cosmos DB, especially under heavy load or large datasets. +2. **Consistency Levels**: The consistency model in Cosmium may differ slightly from Cosmos DB. +3. **Features**: Some advanced features or functionalities of Cosmos DB may not be fully supported or available in Cosmium. + +## Future Development + +Cosmium is actively developed and maintained, with ongoing efforts to improve compatibility with Cosmos DB and enhance its features and capabilities. Future updates may address known differences and limitations, as well as introduce new functionality to bring Cosmium closer to feature parity with Cosmos DB. diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md new file mode 100644 index 0000000..db96b73 --- /dev/null +++ b/docs/CONTRIBUTING.md @@ -0,0 +1,37 @@ +# Contributing to Cosmium + +Thank you for considering contributing to Cosmium! We appreciate your interest in helping to improve our project. + +Please note that by participating in this project, you agree to abide by our [Code of Conduct](/docs/CODE_OF_CONDUCT.md). We expect all contributors to uphold the principles of respect, inclusivity, and professionalism. + +If you have any questions or need assistance with the contribution process, feel free to reach out to us by opening an issue or contacting the maintainers directly. + +We look forward to your contributions! 🚀 + +## Finding ways to contribute + +A great way to contribute is to scan the [Compatibility Matrix](/docs/compatibility.md) for unsupported features and improving compatibility with CosmosDB. + +A part from that, the [Issues page](https://github.com/pikami/cosmium/issues) might contain issues registered by other users. Fixing reported issues is a great way to contribute. + +## How to Contribute + +1. **Create an Issue**: Before starting work on a new feature or bug fix, please create an issue or look for existing ones on the [Issues page](https://github.com/pikami/cosmium/issues) to discuss your proposed changes. This allows us to provide feedback and ensure that your contribution aligns with the project goals. + +2. **Fork the Repository**: Once you have identified an issue to work on, fork the repository to your own GitHub account. + +3. **Create a Branch**: Create a new branch for your changes using a descriptive name that reflects the issue you are addressing. + +4. **Commit Changes**: Commit your changes with clear and descriptive commit messages. Reference the issue number in the commit message. **Please write unit tests for your implemented feature!** + +5. **Create a Pull Request**: Once your changes are ready, create a pull request from your forked repository to the main repository. Be sure to include a detailed description of your changes and reference the relevant issue. + +6. **Review and Collaborate**: Participate in the code review process by addressing any feedback or comments from maintainers. Collaboration and constructive feedback help ensure the quality of contributions. + +## Example Commits + +To get an idea of how to implement new query functions, you can review the following example commits: + +* [Implement IN function](https://github.com/pikami/cosmium/commit/f37c664c1aef39ee820106eaec1a3708ee7a93c8) +* [Implement ToString function](https://github.com/pikami/cosmium/commit/16f41a547956f54481605f0ce035eee978a5e74b) +* [Implement ARRAY_CONCAT, ARRAY_LENGTH, ARRAY_SLICE, SetIntersect, SetUnion functions](https://github.com/pikami/cosmium/commit/1c5e5ce85d70ed91e4b9be9e8f76d59e6eafc1b5)