Coder Social home page Coder Social logo

snaildb's Introduction

Make something fun, not something important.

๐ŸŒ What is SnailDb?

SnailDb is a pseudo-database that runs with the words "Make something fun, not something important" in mind. The pseudo-database aims not to be fast, atomic or production-ready but rather simply itself with its quirks and amazingness.

The pseudo-database is started under the thought that "I can improve my knowledge in this field by making something quirky". It is never intended to be performant, atomic or safe but rather it is created to become a learning experience for me.

SnailDb has several quirks with the following major points:

  • It's a pseudo-database that runs on HTTP protocol and not in raw TCP or even websockets.
  • SNQL (application/x.snail.snql) is designed to be as weird as possible.
  • All the data is stored unencrypted or even secured, it's all there for you to see.

๐ŸŒƒ What is SNQL?

Snail Query Language or SNQL (application/x.snail.snql) is the query language of SnailDb. It's designed with the same mindset as the database with even more weirdness. SNQL's parser is based on simple (and possibly bad) regular expressions and simple parsers that aims to simply be a snail.

SNQL has a few very simple rules that can cause chaos like minified JSON and that is:

  • All elements (arrays, objects, etc.) are values.
  • The keyword AND (all capitalized) is reserved for delimiters e.g. in multi-attributed objects or arrays.
  • Objects must be wrapped in parenthesis (( and )) (e.g. (hello="world" AND good="night")).
  • Arrays must be wrapped in square brackets ([ and ]) (e.g. (array=["hello" AND "world"])).
  • Numbers can be typed with long (int64), int (int32) by writing the type (L for long, I for int, must be capital letters) after the number (e.g. (number=123L)).
  • Numbers can also be not typed with the parser determining which size is best between int64 and int32 (e.g. (number=123)).
  • Strings must be always enclosed in double quotations (e.g. (hello="world")).
  • Decimals cannot be like integers and must always have a penny (e.g. (decimal=0.0)).
  • Snake-casing is more preferred over camel case.

A simple example of a SNQL query would be:

(database="snail" AND collection="users" AND content=(username="Mihou" AND token="Nogizaka46"))

The above query has a translated structure of:

  • database: snail
  • collection: users
  • content:
    • username: Mihou
    • token: Nogizaka46

Assuming that we want to use the following route POST / then the following query would insert a new user into the collection with a username field of "Mihou" and a token of "Nogizaka46".

Although SNQL looks very simple in the surface, the complexity rises as the data grows larger and larger. You should rely on drivers or a generator inside to generate the SNQL for you since it will be a headache.

๐Ÿ’ญ What is the state of SnailDb?

SnailDb is under development with no ETA or deadline in mind.

  • Adds SNQL deserializer.
  • Adds SNQL serializer.
  • Adds SNQL data files to officially declare this a pseudo-database.
  • Adds operations such as INSERT, DELETE, UPDATE and GET with the use of SNQL.
  • Enforces authentication via the Authorization header in the format of user@token.
  • Adds support for indexing of data.

๐Ÿ–ฑ๏ธ Legality

SnailDb's creator, contributors hold no liability over any creations that uses SnailDb. Trademark usage is forbidden and warranty is not provided. You may use SnailDb as you wish as long as it does not affect, shame any of the contributors or its creator.

snaildb's People

Contributors

shindoumihou avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.