How to use entitype - 10 common examples

To help you get started, we’ve selected a few entitype examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github entitype / entitype / packages / common / mywind / string.ts View on Github external
import { Column, Entity } from 'entitype';


@Entity('strings')
export class String {
  
  @Column({ columnName: `string_id`, type: `int(11)`, nullable: false, generated: true, primaryKey: true, default: null })
  stringId: number;
  
  @Column({ columnName: `string_data`, type: `varchar(255)`, default: null })
  stringData?: string;
}
github entitype / entitype / packages / common / northwind-sqlite / employee.ts View on Github external
import { Column, Entity, ManyToMany, OneToMany } from 'entitype';

import { Employeeterritory } from './employeeterritory';
import { Order } from './order';
import { Territory } from './territory';

@Entity('employees')
export class Employee {
  
  @Column({ columnName: `EmployeeID`, type: `int(11)`, nullable: false, generated: true, primaryKey: true, default: null })
  employeeId: number;
  
  @Column({ columnName: `LastName`, type: `varchar(255)`, default: null })
  lastName?: string;
  
  @Column({ columnName: `FirstName`, type: `varchar(255)`, default: null })
  firstName?: string;
  
  @Column({ columnName: `Title`, type: `varchar(255)`, default: null })
  title?: string;
  
  @Column({ columnName: `TitleOfCourtesy`, type: `varchar(255)`, default: null })
  titleOfCourtesy?: string;
github entitype / entitype / packages / common / mywind / employee.ts View on Github external
import { Column, Entity, ManyToMany, OneToMany } from 'entitype';

import { EmployeePrivilege } from './employee-privilege';
import { Order } from './order';
import { Privilege } from './privilege';
import { PurchaseOrder } from './purchase-order';

@Entity('employees')
export class Employee {
  
  @Column({ columnName: `id`, type: `int(11)`, nullable: false, generated: true, primaryKey: true, default: null })
  id: number;
  
  @Column({ columnName: `company`, type: `varchar(50)`, default: null, index: true })
  company?: string;
  
  @Column({ columnName: `last_name`, type: `varchar(50)`, default: null, index: true })
  lastName?: string;
  
  @Column({ columnName: `first_name`, type: `varchar(50)`, default: null, index: true })
  firstName?: string;
  
  @Column({ columnName: `email_address`, type: `varchar(50)`, default: null })
  emailAddress?: string;
github entitype / entitype / packages / common / northwind-sqlite / customer.ts View on Github external
import { Column, Entity, ManyToMany, OneToMany } from 'entitype';

import { Customercustomerdemo } from './customercustomerdemo';
import { Customerdemographic } from './customerdemographic';
import { Order } from './order';

@Entity('customers')
export class Customer {
  
  @Column({ columnName: `CustomerID`, type: `varchar(255)`, nullable: false, primaryKey: true, default: null })
  customerId: string;
  
  @Column({ columnName: `CompanyName`, type: `varchar(255)`, default: null })
  companyName?: string;
  
  @Column({ columnName: `ContactName`, type: `varchar(255)`, default: null })
  contactName?: string;
  
  @Column({ columnName: `ContactTitle`, type: `varchar(255)`, default: null })
  contactTitle?: string;
  
  @Column({ columnName: `Address`, type: `varchar(255)`, default: null })
  address?: string;
github entitype / entitype / packages / common / mywind / customer.ts View on Github external
import { Column, Entity, OneToMany } from 'entitype';

import { Order } from './order';

@Entity('customers')
export class Customer {
  
  @Column({ columnName: `id`, type: `int(11)`, nullable: false, generated: true, primaryKey: true, default: null })
  id: number;
  
  @Column({ columnName: `company`, type: `varchar(50)`, default: null, index: true })
  company?: string;
  
  @Column({ columnName: `last_name`, type: `varchar(50)`, default: null, index: true })
  lastName?: string;
  
  @Column({ columnName: `first_name`, type: `varchar(50)`, default: null, index: true })
  firstName?: string;
  
  @Column({ columnName: `email_address`, type: `varchar(50)`, default: null })
  emailAddress?: string;
github entitype / entitype / packages / common / mywind / invoice.ts View on Github external
import { Column, Entity, ManyToOne } from 'entitype';

import { Order } from './order';

@Entity('invoices')
export class Invoice {
  
  @Column({ columnName: `id`, type: `int(11)`, nullable: false, generated: true, primaryKey: true, default: null })
  id: number;
  
  @Column({ columnName: `order_id`, type: `int(11)`, default: null, index: true })
  orderId?: number;
  
  @Column({ columnName: `invoice_date`, type: `datetime`, default: null })
  invoiceDate?: Date;
  
  @Column({ columnName: `due_date`, type: `datetime`, default: null })
  dueDate?: Date;
  
  @Column({ columnName: `tax`, type: `decimal(19,4)`, default: 0.0000 })
  tax?: string;
github entitype / entitype / packages / common / mywind / supplier.ts View on Github external
import { Column, Entity, OneToMany } from 'entitype';

import { PurchaseOrder } from './purchase-order';

@Entity('suppliers')
export class Supplier {
  
  @Column({ columnName: `id`, type: `int(11)`, nullable: false, generated: true, primaryKey: true, default: null })
  id: number;
  
  @Column({ columnName: `company`, type: `varchar(50)`, default: null, index: true })
  company?: string;
  
  @Column({ columnName: `last_name`, type: `varchar(50)`, default: null, index: true })
  lastName?: string;
  
  @Column({ columnName: `first_name`, type: `varchar(50)`, default: null, index: true })
  firstName?: string;
  
  @Column({ columnName: `email_address`, type: `varchar(50)`, default: null })
  emailAddress?: string;
github entitype / entitype / packages / common / northwind-sqlite / supplier.ts View on Github external
import { Column, Entity, OneToMany } from 'entitype';

import { Product } from './product';

@Entity('suppliers')
export class Supplier {
  
  @Column({ columnName: `SupplierID`, type: `int(11)`, nullable: false, generated: true, primaryKey: true, default: null })
  supplierId: number;
  
  @Column({ columnName: `CompanyName`, type: `varchar(255)`, nullable: false, default: null })
  companyName: string;
  
  @Column({ columnName: `ContactName`, type: `varchar(255)`, default: null })
  contactName?: string;
  
  @Column({ columnName: `ContactTitle`, type: `varchar(255)`, default: null })
  contactTitle?: string;
  
  @Column({ columnName: `Address`, type: `varchar(255)`, default: null })
  address?: string;
github entitype / entitype / packages / common / mywind / privilege.ts View on Github external
import { Column, Entity, ManyToMany } from 'entitype';

import { Employee } from './employee';
import { EmployeePrivilege } from './employee-privilege';

@Entity('privileges')
export class Privilege {
  
  @Column({ columnName: `id`, type: `int(11)`, nullable: false, generated: true, primaryKey: true, default: null })
  id: number;
  
  @Column({ columnName: `privilege_name`, type: `varchar(50)`, default: null })
  privilegeName?: string;
  
  @ManyToMany(type => Employee, joinType => EmployeePrivilege, x => x.privilegeId, x => x.employeeId)
  employeePrivileges: Employee[];
}
github entitype / entitype / packages / common / northwind-sqlite / territory.ts View on Github external
import { Column, Entity, ManyToMany, ManyToOne } from 'entitype';

import { Employee } from './employee';
import { Employeeterritory } from './employeeterritory';
import { Region } from './region';

@Entity('territories')
export class Territory {
  
  @Column({ columnName: `TerritoryID`, type: `varchar(255)`, nullable: false, primaryKey: true, default: null })
  territoryId: string;
  
  @Column({ columnName: `TerritoryDescription`, type: `varchar(255)`, nullable: false, default: null })
  territoryDescription: string;
  
  @Column({ columnName: `RegionID`, type: `int(11)`, nullable: false, default: null, index: true })
  regionId: number;
  
  @ManyToMany(type => Employee, joinType => Employeeterritory, x => x.territoryId, x => x.employeeId)
  employeeterritories: Employee[];
  
  @ManyToOne(type => Territory, x => x.regionId)
  region: Region;

entitype

An ORM framework for Typescript that lets you fluently query the database with a strongly-typed API.

MIT
Latest version published 6 years ago

Package Health Score

42 / 100
Full package analysis

Popular entitype functions