New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

@eggjs/orm-decorator

Package Overview
Dependencies
Maintainers
10
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@eggjs/orm-decorator

tegg orm decorator

beta
Source
npmnpm
Version
4.0.2-beta.27
Version published
Weekly downloads
0
Maintainers
10
Weekly downloads
 
Created
Source

@eggjs/orm-decorator

NPM version Known Vulnerabilities npm download Node.js Version

Install

npm i --save @eggjs/orm-decorator

Define Model

import { Model, Attribute } from '@eggjs/orm-decorator';
import leoric from 'leoric';

const { DataTypes, Bone } = leoric;

@Model()
export class App extends Bone {
  @Attribute(DataTypes.STRING)
  name: string;
  @Attribute(DataTypes.STRING)
  desc: string;
}

Use Model

import { SingletonProto, Inject } from '@eggjs/tegg';
import { App } from './model/App';

@SingletonProto()
export class AppService {
  @Inject()
  App: typeof App;

  async createApp(data: { name: string; desc: string }): Promise<App> {
    const bone = await this.App.create(data as any);
    return bone as App;
  }

  async findApp(name: string): Promise<App | null> {
    const app = await this.App.findOne({ name });
    return app as App;
  }
}

Keywords

egg

FAQs

Package last updated on 20 Sep 2026

Related posts