Dubnium
v2
v2
  • Install
  • Overview
  • Initialize
  • Manage
  • Get
  • Modify
  • Templates
  • CLI
  • Events
  • Plugins
    • Create
  • Miscellaneous
  • Update Log
  • Need more help?
Powered by GitBook
On this page
  • Make a new Template
  • Use Template
  • Full code example

Was this helpful?

Templates

An easy way to keep your JSON records similar!

Make a new Template

const { Dubnium, Template } = require('dubnium') // require('dubnium') is an alias of require('dubnium').Dubnium
const template = new Template({
id:"",
name:"",
password:""
})
import { Dubnium, Template } from 'dubnium'
const template = new Dubnium.Template({
id:"",
name:"",
password:""
})
Parameter
About
Type
Required

template

The object to base the new Template on.

Object

Use Template

database.create('tag', template.use('123456',"John","password"))

The parameters of this function are what will be set to the value of the keys in order.

Example: the parameterJohn will be the value of namesince they are both in the second position.

Full code example

const { Dubnium, Template } = require('dubnium')
// import { Dubnium, Template } from 'dubnium' // for ESM
const database = new Dubnium('./db','json' /* Templates are JSON only */) // Initialize a database

const template = new Template({ // Make a new Template
id:"",
name:"",
password:""
})

database.create('tag', template.use('123456',"John","password")) // Create a Record based on the Template
PreviousModifyNextCLI

Last updated 2 years ago

Was this helpful?