Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

avalon-server-util

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

avalon-server-util

avalon server side common util

  • 1.0.16
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

avalon-server-util

安装方法

npm install avalon-server-util

mysql

avalonSql

  • 作用:sql相关的操作,目前只支持mysql

  • 原理:使用mysqljs/mysql库实现

  • 作用:对程序自身的mysql数据库进行版本管理,代替运维操作,只适用于数据量较小的库;注意:该库不做异常捕获

  • 原理:创建一个sql更新记录的table,每次启动服务器时对比sql文件和历史记录,如果是新sql则执行更新

  • Demo示例

const {avalonSql} = require("avalon-server-util")
await sqlVersionManager.load({
    mysqlConnection:{
        host:mysql主机名, 
        port:mysql端口,
        user:mysql用户名,
        password:mysql密码,
        database:mysql库名(运维建库名称),
    },
    sqlDir:存放sql文件的目录,
    databaseDevName:数据库的开发名称(区别于运维建库的名称)
})

system

  • 作用:热加载模块,不重启应用重新读取js文件
  • 原理:使用node自带函数实现
  • Demo示例
const {system: {requireUncached}} = require("avalon-server-util")
const path = require("path")

const doSomeThing = ()=>{
    //此处只能使用相对路径
    const m = requireUncached(path.resolve(__dirname, "../xxx/xxx"))
    
}

FAQs

Package last updated on 02 Jul 2019

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