Giter Club home page Giter Club logo

cdb's Introduction

CDB - Fast and efficient NoSQL database written in pure C

It is a non-relational database written in pure C for fast performance. At the moment, this database can only store strings, but it may soon be possible to store other types of data.

Features

  • It only takes up 52 lines!
  • Saved to its proprietary file format(It's just writing a structure to a binary file)
  • The compiled source is only 140 KB
  • Performance

Examples:

Main example
#include "cdb.h"
#include <stdio.h>

int main() {
  cdb_database db;
  cdb_init_database(&db);

  // добавляем записи в БД
  cdb_set(&db, "key1", "value1");
  cdb_set(&db, "key2", "value2");
  cdb_set(&db, "key3", "value3");

  // сохраняем БД в файл
  cdb_save_database(&db, "mydb.cdb");

  // загружаем БД из файла
  cdb_load_database(&db, "mydb.cdb");

  // получаем список ключей
  char** keys = cdb_get_keys(&db);
  for (int i = 0; i < db.count; i++) {
    printf("%s\n", keys[i]);
  }
  free(keys);

  // получаем значение по ключу
  char* value = cdb_get_value(&db, "key1");
  printf("%s\n", value);

  // удаляем запись из БД
  cdb_remove(&db, "key2");

  // сохраняем изменения в файл
  cdb_save_database(&db, "mydb.cdb");

  return 0;
}

Created with 💝

cdb's People

Contributors

dm-vev avatar

Stargazers

 avatar Eason Wang avatar  avatar Sergiy Chernega avatar

Watchers

 avatar  avatar

Forkers

nextmine

cdb's Issues

add HTTP API

TODO: Make a dedicated database server for access via HTTP requests, as well as add a Command Promt for management

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.