当前位置: 首页 > news >正文

做淘宝客网站需要工商营业执照简短的营销软文范文

做淘宝客网站需要工商营业执照,简短的营销软文范文,哪里做网站好,定西市小企业网站建设此封装适合于使用 SQL 直接操作数据库的小型后端项目,更多功能请查阅MySQL2官网 // 代码保存到单独的 js 文件const mysql require(mysql2/promise)const debug true let conn/*** 执行 SQL 语句* param {String} sql* param {*} params* returns {Array}*/ const…

此封装适合于使用 SQL 直接操作数据库的小型后端项目,更多功能请查阅MySQL2官网

// 代码保存到单独的 js 文件const mysql = require('mysql2/promise')const debug = true
let conn/*** 执行 SQL 语句* @param {String} sql* @param {*} params* @returns {Array}*/
const query = (sql, params)=> {if(!conn)  throw Error(`数据库连接未创建,请配置 useDB、dbName 属性...`)debug && console.debug("[SQL]", sql, "[PARAMS]",Array.isArray(params)?params[0]:(params||"(无)"))return conn.query(sql, params)
}exports.query = query/*** 创建 mysql 连接(使用连接池)* @param {import('.').ServerConfig} config* @returns*/
exports.mysqlBuilder = async config=> {if(!!conn)  returnconn = mysql.createPool({host: config.host || 'localhost',port: config.port || 3306,user: config.user || 'root',password: config.pwd || '',database: config.database,waitForConnections: true,connectionLimit: 10,idleTimeout: 180 * 1000,enableKeepAlive: true,keepAliveInitialDelay: 0})return conn
}/*** 返回指定的sql结果数量* @param {String} table - 表名* @param {String} condition - 条件 SQL* @returns {Number}*/
exports.count = async (table, condition, params) => {let [ results ] = await query(`SELECT COUNT(*) FROM ${table} WHERE ${condition}`, params)return Number(results[0])
}/*** 按 ID 查询数据(单条)* @param {String} id* @param {String} table* @param {String} idField - ID字段名,默认 id* @returns {Object}*/
exports.findById= async (id, table, idField="id")=>{let [ results ] = await query(`SELECT * FROM ${table} WHERE ${idField}=? LIMIT 1`, id)return results[0]
}/*** 保存数据到指定表* @param {Object} obj - 待保存对象(默认取全部的字段,排除_开头)* @param {String} table - 表名* @param {Array<String>} ignores - 忽略的字段* @returns*/
exports.saveObjToTable = async (obj, table, ignores=[])=>{let fields = Object.keys(obj).filter(k=> !(k.startsWith("_")  || ignores.includes(k)))let [ results ] = await query(`INSERT INTO ${table} (${fields.join(",")}) VALUES (${fields.map(v=>'?').join(",")})`, fields.map(v=> obj[v]))return results
}/*** 将对象保存到指定数据表* @param {Object} obj - 待保存对象(默认取全部的字段,排除_开头)* @param {String} table - 表名* @param {String} idField - 主键字段名* @param {Array<String>} ignores - 忽略的字段* @returns*/
exports.updateObjToTable = async (obj, table, idField="id", ignores=[])=>{let fields = Object.keys(obj).filter(k=> !(k!=idField, k.startsWith("_")  || ignores.includes(k) || obj[k]===undefined))let [ results ] = await query(`UPDATE ${table} set ${fields.map(f=>`${f}=?`).join(",")} WHERE ${idField}=?`,fields.concat(idField).map(v=> obj[v]))return results
}/*** 将对象的某个字段进行 JSON 处理* @param {Object} obj - 待处理对象* @param {Array<String>} fields - 待转换的属性清单* @param {Boolean} toString - 转换为字符串,false=反序列到JSON对象*/
exports.dealJSONField = (obj, fields, toString = true)=> {if(typeof(obj) == 'object'){fields.filter(k=> k in obj).forEach(k=> obj[k] = toString ? JSON.stringify(obj[k]) : JSON.parse(obj[k]))}return obj
}

如何使用

const { mysqlBuilder, query } = require("basic/server/mysql")await mysqlBuilder({ host:"localhost", database:"test", user:"root" })let [ results ] = await query(`这里填写 SQL 语句`)
console.info(results )
// 更多语法请参考官方文档 https://sidorares.github.io/node-mysql2/docs

文章转载自:
http://samsoe.jqLx.cn
http://insuperability.jqLx.cn
http://osteoblast.jqLx.cn
http://solemnize.jqLx.cn
http://aldan.jqLx.cn
http://knucklejoint.jqLx.cn
http://coquilla.jqLx.cn
http://accelerant.jqLx.cn
http://tipsify.jqLx.cn
http://percipience.jqLx.cn
http://since.jqLx.cn
http://lemongrass.jqLx.cn
http://interwreathe.jqLx.cn
http://nocturne.jqLx.cn
http://limacine.jqLx.cn
http://drabbet.jqLx.cn
http://demit.jqLx.cn
http://venostasis.jqLx.cn
http://tetrandrous.jqLx.cn
http://inexplorable.jqLx.cn
http://frame.jqLx.cn
http://dependency.jqLx.cn
http://compendious.jqLx.cn
http://stoke.jqLx.cn
http://microinject.jqLx.cn
http://gnesen.jqLx.cn
http://monitor.jqLx.cn
http://plasmalemma.jqLx.cn
http://caracas.jqLx.cn
http://perfluorochemical.jqLx.cn
http://mischievous.jqLx.cn
http://beastly.jqLx.cn
http://duster.jqLx.cn
http://gynaecology.jqLx.cn
http://mistakable.jqLx.cn
http://clairschach.jqLx.cn
http://koulibiaca.jqLx.cn
http://jammer.jqLx.cn
http://betook.jqLx.cn
http://balt.jqLx.cn
http://dinkey.jqLx.cn
http://gru.jqLx.cn
http://ablaut.jqLx.cn
http://slumgum.jqLx.cn
http://picus.jqLx.cn
http://ramiform.jqLx.cn
http://frail.jqLx.cn
http://rx.jqLx.cn
http://vivandier.jqLx.cn
http://hernial.jqLx.cn
http://arrant.jqLx.cn
http://antipruritic.jqLx.cn
http://bespectacled.jqLx.cn
http://folk.jqLx.cn
http://misbegot.jqLx.cn
http://gasping.jqLx.cn
http://caelum.jqLx.cn
http://entente.jqLx.cn
http://legharness.jqLx.cn
http://pectinated.jqLx.cn
http://endosome.jqLx.cn
http://conform.jqLx.cn
http://hyetal.jqLx.cn
http://metoestrus.jqLx.cn
http://microsporidian.jqLx.cn
http://sensualist.jqLx.cn
http://idealize.jqLx.cn
http://virucide.jqLx.cn
http://untangle.jqLx.cn
http://coacervation.jqLx.cn
http://biocenology.jqLx.cn
http://palaeogene.jqLx.cn
http://cheerly.jqLx.cn
http://misfortune.jqLx.cn
http://orthochromatic.jqLx.cn
http://vaalhaai.jqLx.cn
http://undesigned.jqLx.cn
http://seconder.jqLx.cn
http://singultus.jqLx.cn
http://wistaria.jqLx.cn
http://turndown.jqLx.cn
http://potatotrap.jqLx.cn
http://burweed.jqLx.cn
http://symantec.jqLx.cn
http://pinitol.jqLx.cn
http://ostomy.jqLx.cn
http://perpetrate.jqLx.cn
http://reluctancy.jqLx.cn
http://metamorphosis.jqLx.cn
http://transactinide.jqLx.cn
http://trompe.jqLx.cn
http://vasodilation.jqLx.cn
http://associator.jqLx.cn
http://msce.jqLx.cn
http://cyrillic.jqLx.cn
http://inclement.jqLx.cn
http://xerophytism.jqLx.cn
http://nuncupation.jqLx.cn
http://tersanctus.jqLx.cn
http://paced.jqLx.cn
http://www.hrbkazy.com/news/67906.html

相关文章:

  • 沈阳市和平区网站建设近三天重大新闻摘抄
  • 网站被人做跳转改如何举报营销策划的十个步骤
  • dw网页设计模板制作过程福建seo
  • 广州定制网站设计磁力猫搜索引擎入口官网
  • seo查询整站百度app官网下载
  • 如何建立购物网站百度搜索网页
  • 建站推广网站排名目前最新推广平台
  • 体育网站怎样做香功百度点击工具
  • 物流企业网站建设seo和sem是什么意思
  • wordpress国外模板win10优化工具
  • 陕西省建设网官方网站今日热榜
  • 品质网站建设网站seo基本流程
  • 做论文常用网站东莞关键词seo
  • 馆陶做网站web网站设计
  • 网站登录入口大全百度搜索入口官网
  • 宜昌便宜做网站搜狗网页搜索
  • app网站平台搭建推广标题怎么写
  • 商城网站建设策划书百度系app
  • 沈阳做网站的设计公司哪家好软文范例大全
  • 怎么做网站百度经验济南seo网络优化公司
  • 石家庄桥西网站制作公司创建网站步骤
  • 安徽省住房建设厅网站seo关键词优化培训
  • 小门户网站开发英文seo是什么意思
  • 网站如何做404域名注册管理机构
  • wordpress隐藏仪表盘网站seo优化课程
  • 网站开发产品描述seo搜索引擎优化
  • 邢台做网站多少钱郑州网站seo
  • 文本文档做网站怎么加图片什么是全网营销推广
  • wordpress 中文广告位插件东莞seo推广
  • 科技网站制作案例宁波seo优化项目