New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

tydet-core-mysql

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tydet-core-mysql

TyDeT Core MySQL is a Typescript & Javascript library for TyDeT Core to handle connections with a MySQL Database.

latest
Source
npmnpm
Version
2.0.3
Version published
Maintainers
1
Created
Source

TyDeT Core MySQL

TyDeT Core MySQL is a Typescript & Javascript library for TyDeT Core to handle a connection to a MySQL database.

TyDeT (Typescript Developer Tools) Core MySQL is a module for TyDeT Core to handle a connection with a MySQL Database and managing the entities, validations, migrations and other tools.

Installation

This is a Node.js module available through the npm registry. Installation is done using the npm install command:

npm install tydet-core tydet-core-mysql

It is required to install TyDeT Core to use this module.

Usage

Basic usage

import { Context } from 'tydet-core';
import { MysqlConnector, MysqlEntity, QueryFind } from 'tydet-core-mysql';

// Add connector as Service
let app = new Context()
let mysql = new MysqlConnector()
await app.mountService("mysql", mysql)

// Execute queries
let query = QueryFind(mysql, "users", {firstName: "My name"})
let data = await mysql.run(query)

// Define entities
class User extends MysqlEntity {
  id: number
  firstName: string
  lastName: string
}

User.DefineSchema("users", {
  id: {
    type: MysqlDataType.INT,
    primaryKey: true
  },
  firstName: {
    type: MysqlDataType.VARCHAR,
    required: true
  },
  lastName: MysqlDataType.VARCHAR
})

class Comment extends MysqlEntity {
  id: number
  message: string
  userId: number
  createdAt: Date

  user?: User
}

Comment.DefineSchema("comments", {
  id: {
    type: MysqlDataType.INT,
    primaryKey: true
  },
  message: {
    type: MysqlDataType.VARCHAR,
    required: true
  },
  userId: MysqlDataType.INT,
  createdAt: {
    type: MysqlDataType.DATETIME,
    default: MysqlDefaultValue.NOW
  }
})

User.hasMany(Comment, "userId")
Comment.belongsTo(User, "userId", "user")

let users = await User.Find(mysql, {firstName: "My name"})

Check the docs for more details about the service.

Changelog

Learn about the latest improvements.

License

MIT License.

Contributing

We'd love for you to contribute to TyAPI Core Mysql and help make it even better than it is today! Find out how you can contribute here.

Keywords

typescript

FAQs

Package last updated on 20 Aug 2025

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