2.0.3 • Published 2 years ago

kyatatsu v2.0.3

Weekly downloads
1
License
MIT
Repository
github
Last release
2 years ago

KYATATSU

A javascript library for managing data models and interfacing with Couchbase buckets.

Kyatatsu: Japanese for footstool. This module is named thus as a lightweight, non ODM replacement for Ottoman.

Usage

Set up Kyatatsu in you main project script (usually server.js) like so

const kyatatsu = require('kyatatsu')
kyatatsu.couchbaseUrl = "couchbase://127.0.0.1"
kyatatsu.bucketName = "my_bucket"
kyatatsu.connect()
  .then(cluster => {
    cluster.query("...etc.")
  })

Create your models in their own scripts like so:

const kyatatsu = require('kyatatsu')

let schema = {
    name: {
        required: true
    },
    birthday: {
        default: () => new Date()
    }
}

kyatatsu.registerModel('Person', schema)
let Person = kyatatsu.model('Person')

module.exports = Person

Schema properties

Specify properties in a schema by assigning them an object with one of the following properties:

  • required: (true or false) indicates whether or not the property is required on all model instances
  • default: ( () => {} ) function taking no arguments and returning the default value for that property
  • type: ('ref') used to specify if the property is a reference to another model

Testing

Currently, the test/ directory only has an example of using Kyatatsu for two models (Person and History) Actual Unit Tests will come later

2.0.3

2 years ago

2.0.2

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.0.10

6 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago