Tachyon

0.0.1 • Public • Published

tachyon

TachyonDB schemaless, asynchronous data modeling library. Disclaimer: not production tested, or spec complete!

introduction

TachyonDB provides a schemaless interface for building and manipulating object models on top of relational databases.

interface

defining a model

const UserEntity = new EntityType('User', {
  canonicalEmail: { type: Types.string, index: true },
  firstName: { type: Types.string },
  lastName: { type: Types.string },
  genderPreference: { type: Types.number },
  createdAt: { type: Types.dateTime, index: true}
})

inserting a model

const newUser = UserEntity
  user.setProperty(
    'canonicalEmail',
    'jasonbyttow@gmail.com'
  )
  insertEntity((newUser)
  .then((user) => {
    console.log(`user ${user.getProperty('canonicalEmail')} added`)
  })

retrieving a model

getEntityByKeyValue(
  UserEntity.type,
  UserEntity.schema.canonicalEmail.type,
  'canonicalEmail',
  'jasonbyttow@gmail.com'
)
.then((user) => {
 if (user) {
   console.log(`user ${user.getProperty('canonicalEmail')} retrieved`)
 }
})

Readme

Keywords

none

Package Sidebar

Install

npm i Tachyon

Weekly Downloads

0

Version

0.0.1

License

none

Last publish

Collaborators

  • jbyttow