Skip to content

TachyonDB schemaless, asynchronous data modeling library

Notifications You must be signed in to change notification settings

jbyttow/tachyon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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 a relational database.

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 ${newUser.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`)
 }
})

About

TachyonDB schemaless, asynchronous data modeling library

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages