New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@knorm/timestamps

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@knorm/timestamps

Timestamps plugin for @knorm/knorm

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

@knorm/timestamps

npm version build status coverage status dependency status Greenkeeper badge

Timestamps plugin for @knorm/knorm.

This plugin adds the knex timestamp fields to your models and also updates your query methods so that createdAt and updatedAt are set to the current time (i.e. new Date()) for insert calls and the updatedAt field is set to the current time for any update calls. It will also ensure that any update calls do not overwrite the createdAt field.

Installation

npm install --save @knorm/knorm @knorm/timestamps

@knorm/timestamps has a peer dependency on @knorm/knorm

Usage

const knorm = require('@knorm/knorm');
const knormTimestamps = require('@knorm/timestamps');

const orm = knorm({
  // knorm options
}).use(
  knormTimestamps({
    // knormTimestamps options
  })
);

Options

name

The name of the plugin, defaults to 'timestamps'.

createdAt

type: object, default: { name: 'createdAt', column: 'created_at' }

The createdAt field can be configured with these options:

  • name string, default: createdAt: the field name
  • column string, default: created_at: the column name

updatedAt

type: object, default: { name: 'updatedAt', column: 'updated_at' }

The updatedAt field can be configured with these options:

  • name string, default: updatedAt: the field name
  • column string, default: updated_at: the column name

Keywords

FAQs

Package last updated on 27 Jun 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc