GithubHelp home page GithubHelp logo

ui-js's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ui-js's Issues

ormjs: regeneratorRuntime undefined

@uMaxmaxmaximus

/Users/noah/Projects/dreamer-api/node_modules/ormjs/fields/field-models.js:117
			var ref = _asyncToGenerator(regeneratorRuntime.mark(function _callee(model) {
			                            ^

ReferenceError: regeneratorRuntime is not defined
    at /Users/noah/Projects/dreamer-api/node_modules/ormjs/fields/field-models.js:117:32

https://github.com/uMaxmaxmaximus/ui-js/blob/master/server/core/orm/fields/field-models.js#L117

EDIT: I have forked this and made a purely ormjs repo, which also changes the build method to babel, and fixes this problem. It's here: https://github.com/OKNoah/ormjs

ormjs: Edge collection modelling

Hi, I'd like to work a bit on this package. I've forked it at https://github.com/OKNoah/ormjs.

I'm pretty new to ArangoDB.

I'd like to try add support for modelling edge collections. I believe this is done by var actsIn = db._createEdgeCollection("actsIn"); in the javascript driver, as seen here: https://github.com/arangodb/Cookbook/blob/master/recipes/Graph/ExampleActorsAndMovies.md

I'm just thinking of the syntax now. Open to suggestions. Perhaps like this.

import Model, { Edge } from './db'

/* A User lives at an Address */
export default class LivesAt extends Edge {
  static schema = {
    created: Date
  }
}

export default class User extends Model {
  static schema = {
    name: String,
    created: Date
  }
}

export default class Address extends Model {
  static schema = {
    street: String,
    city: String
  }
}

const user = await User.add({
  name: 'Will',
  created: Date()
})

const address = await Address.add({
  city: 'Bel Air'
})

const relationship = await LivesAt.add(user, address)

user.save()
address.save()
relationship.save()

ormjs: findByQuery feature

Currently it looks like the app just has one way to find things, which is with the byExample method. We could add a findByQuery method to allow passing a string query.

City.findByQuery(`
  for city in outbound 'city/VANCOUVER' trips
    return distinct city
`)

Any thoughts on this?

ormjs: Attributes

User.find(
  { active: true },
  0,
  10,
  { $attributes: ['_id', 'name', 'email'] }
)

This will do

static async find (selector, skip = 0, limit = 100, options) {
    if (!selector) selector = {}
    limit = Math.min(Math.max(limit, 0), 100)
    selector._removed = false
    const cursor = await this._call('byExample', selector, {skip, limit})
    const documents = await cursor.all()
    return documents.map(document => {
      let doc = document
      if (options.$attributes) doc = _.pick(document, options.$attributes)
      return this._createModelByDocument(doc)
    })
  }

ormjs: includes syntax

I had the idea of using this syntax for joins.

User.findOne({
  email: body.email,
  $include: {
    active: true,
    $collection: Team
  }
})

This would find a User by their email, then find any of their teams, using the filter {active: true}.

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.