Giter Club home page Giter Club logo

odin's Introduction

Odin

Odin is an implementation of Active Record pattern in TypeScript.

NPM Version Node Version TypeScript Version Tested With Jest Pull Requests License Build Status Coverage Status Package Quality Dependencies Status NPM Total Downloads NPM Monthly Downloads Open Issues Closed Issues known vulnerabilities Github Stars Github Forks

Table of Content

Installation

Before installing, download and install Node.js. Node.js 8 or higher is required.

npm i -s @foxify/odin

Usage

const Odin = require("@foxify/odin");

const { Types } = Odin;

class User extends Odin {
}

User.schema = {
  email: Types.String.email.required,
  name: {
    first: Types.String.min(3).required,
    last: Types.String.min(3),
  }
};

Features

  1. Written in ES6
  2. TypeScript ready
  3. Active Record pattern
  4. Schema validation
  5. GraphQL Schema generator (based on model schema)
  6. JSON Schema generator (based on model schema)

TODO (RoadMap to version 1.0.0)

  • Schema validation
  • Model
    • Hooks
      • create
      • update
      • delete
      • restore
    • Relationships
      • embedMany
      • hasMany
      • hasOne
      • hasManyThrough
      • hasOneThrough
      • Polymorphic
        • morphMany
        • morphOne
        • morphTo
        • morphManyThrough
        • morphOneThrough
        • morphToThrough
      • CRUD operations
        • Create operation
        • Read operation
        • Update operation
        • Delete operation
    • GraphQL support
    • JSON Schema support
  • Migrations
  • Seeding
  • Tests

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Changelog

See the CHANGELOG.md file for details

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE file for details

Support

If my work helps you, please consider

Buy Me A Coffee Become A Patron

odin's People

Contributors

ardalanamini avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

tjercus

odin's Issues

Join On

This change helps to query the joined table by multiple filters

Expected behavior

type Query = {
    on: (joinedField: string, operator: Driver.Operator | any, value?: any) => Query
    onFields: (joinedField: string, operator: Driver.Operator | string, field?: string) => Query
};

join(table: string, (query: Query) => any): DB<T>;

Actual behavior

join(table: string, localKey?: string, foreignKey?: string, as?: string): DB<T>;

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.