Giter VIP home page Giter VIP logo

zussel-matador's Introduction

matador

Version 0.5.0

Take your database by the horns.

Build Status Build Status Coverage Status Gitter GitHub version GitHub license

matador is a ORM framework written in C++. It aims to encapsulate all database stuff (database backends, sql statements, serialization of objects) and provides the user an easy to use interface and a unique container for all objects. Given this container the user has a centralized point of storage for all objects at hand but with the ability to create views on concrete object types.

Features:

  • A unique fluent query interface
  • Support for SQLite, MySQL and MS SQL Server
  • One to one/many relations
  • One storage container
  • Filter with simple expressions
  • Transactions
  • STL like interface and iterators

Documentation can be found here.

Example

// use matador' namespace
using namespace matador

// a simple person class
struct person {
  identifier<long> id;   // primary key
  varchar<256> name;
  unsigned int age = 0;
  has_many<string> colors;
  
  person(long i, const std::string n)
    : id(i), name(n)
  {}
  
  template < class SERIALIZER >
  void serialize(SERIALIZER &serializer) {
    serializer.serialize("id", id);
    serializer.serialize("name", name);
    serializer.serialize("age", age);
    serializer.serialize("person_color", colors, "person_id", "color");
  }
};

// prepare the persistence layer
persistence p("sqlite://db.sqlite");
p.attach<person>("person");

// create tables
p.create();

// create a database session
session s(p);

// insert george
// returns an matador::object_ptr<person>
auto george = s.insert(new person(1, "george"));

// modify george
george->age = 35;
s.update(george);
// add color
s.push_back(george->colors, "brown");
// delete george
s.remove(george);

Requirements

The library has almost no dependencies. At least the database library you want to use. If you would like to build from the sources you need at least the cmake build system installed. If you plan to generate an install package on a windows system you need the nullsoft scriptable install system.

Sources

Get the sources from GitHub and enter the created directory:

$ git clone https://github.com/zussel/matador.git
$ cd matador

Building under Linux

Create a build directory change to it and call cmake:

$ mkdir build
$ cd build
$ cmake ..

Then you can build matador from sources:

$ make

Building under Windows (for Visual Studio)

Create a build directory change to it and call cmake:

$ mkdir build
$ cd build
$ cmake -G "Visual Studio *" ..

Where * is one of the "Visual Studio" strings up from "14". See cmake documentation here. After generation you find a matador.sln solution file in the current directory.

Contact

If you have questions or issues concerning matador you can place an issue in my matador github repository or contact me via mail sascha dot kuehl at gmx dot net.

zussel-matador's People

Contributors

tyroxx avatar waffle-with-pears avatar

Watchers

 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.