网站首页 站内搜索

搜索结果

查询Tags标签: err,共有 632条记录
  • 一个typescript版本的dao(数据库访问)层的封装

    首先学会使用mustache语法 select * from {{key1}}字符中{{key1}}会进行匹配map中的key 例如:let sql = select * from {{key1}};let tableMapper = {"key1": "course",}let result = mustache.render(sql, tableMapper);console.log(result:, resul…

    2022/8/13 2:22:54 人评论 次浏览
  • 【原创】Promise异步编程

    show me the codefunction getPromise(cbk){return (new Promise(cbk)); }getPromise(function (res,rej) {res("suc1") //只会执行一个,并把参数传递到catch或者thenrej("err1") }).catch(function(err){console.log(err,1) }).then(function (res)…

    2022/8/12 1:27:58 人评论 次浏览
  • golang执行shell命令

    golang调用shell命令(实时输出, 终止等) 背景 是这样的,最近在研究一个定时任务系统的改造,可能有点像jenkins做到的那种吧。​可以输入shell命令,也可以执行py脚本等等,相比之前来说,也要能够及时停止!​但是遇到了这么个问题,golang执行py脚本的时候获取不到脚…

    2022/8/11 5:23:05 人评论 次浏览
  • golang执行linux

    func copyAndCapture(w io.Writer, r io.Reader) ([]byte, error) {var out []bytebuf := make([]byte, 1024, 1024)for {n, err := r.Read(buf[:])if n > 0 {d := buf[:n]out = append(out, d...)os.Stdout.Write(d)}if err != nil {// Read returns io.EOF at the en…

    2022/8/11 5:23:04 人评论 次浏览
  • golang执行linux (2)

    目录 [−]执行命令并获得输出结果将stdout和stderr分别处理命令执行过程中获得输出命令执行过程中获得输出2命令执行过程中获得输出3改变执行程序的环境(environment)预先检查程序是否存在管道管道2原文: Advanced command execution in Go with os/exec by Krzysztof Kow…

    2022/8/11 5:23:03 人评论 次浏览
  • Golang 程序读取yaml配置文件

    1、安装依赖;go get gopkg.in/yaml.v2 2、添加配置文件config.yaml;redis:port: 3306user: redismysql:userName: rootpassWord: mysql3、编写go代码读取配置文件数据;package mainimport ("fmt""gopkg.in/yaml.v2""os" )type conf struc…

    2022/8/9 1:23:08 人评论 次浏览
  • 成绩文件读取写入

    const fs = require(fs)fs.readFile(./files/成绩.txt, utf8, function (err, dataStr) {if (err) {return console.log(读取文件失败 + err.message);}//console.log(读取文件成功 + dataStr)const arrOld = dataStr.split( )//console.log(arrOld)const arrNew = []arrO…

    2022/7/31 23:39:27 人评论 次浏览
  • gin CRUD

    gin CRUD// units package dal//cxg 2022-7-29 import ("net/url""svrGIN/db""svrGIN/model""github.com/gin-gonic/gin/binding""strings""svrGIN/log""github.com/gin-gonic/gin" )func SelectU…

    2022/7/29 23:25:03 人评论 次浏览
  • NodeJS 连接 Redis 读写操作

    一、Redis 基础 Redis 可以说是最最最简单的数据库了。大部分数据库的读写操作都是在硬盘上的,而 Redis 是在内存上的。所以读写速度会比其他传统数据库要快。但缺点是数据不能持久化,一旦断电重启,数据就没了。当然,Redis 也是可以将数据持久化的,但我觉得这样做的成…

    2022/7/26 2:24:28 人评论 次浏览
  • node的静态资源加载

    静态加载资源(html,css,js,图片等):选择fs模块;let fs=require(fs);使用readfile方法:fs.readfile(参数1,参数2)参数1:返回错误的结果参数2:已经加载的金泰5资源将已静态资源加载后的值打印到页面中:res.write(参数2) if(url==/index&&method==GET){…

    2022/7/24 14:23:41 人评论 次浏览
  • golang中使用mongodb

    一、mongodb封装代码var client *mongo.Clientfunc NewMongoDB(ctx context.Context, appUri string) error {//连接到mongodbc, err := mongo.Connect(ctx, options.Client().ApplyURI(appUri))if err != nil {return err}//检查连接err = c.Ping(ctx, nil)if err != nil…

    2022/7/23 2:23:56 人评论 次浏览
  • 自建redis迁移云报错

    java服务开始使用的自建的redis 将其迁移到腾讯云redis时报错 如下: 14:22:56.048 [localhost-startStop-1] ERROR o.s.web.context.ContextLoader:351 - Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean …

    2022/7/21 2:23:35 人评论 次浏览
  • NPM 安装报 Error: EACCES: permission denied, mkdir ‘/usr/local/lib/node_modules/xxxxxx‘ 解决

    今天使用 npm i docsify-cli -g 安装 node 脚手架工具时,出现以下错误:andrew@Andrews-MacBook-Pro CSNotes % npm i docsify-cli -gnpm ERR! code EACCESnpm ERR! syscall mkdirnpm ERR! path /usr/local/lib/node_modules/docsify-clinpm ERR! errno -13npm ERR! Erro…

    2022/7/20 9:19:38 人评论 次浏览
  • Golang仿云盘项目-3.2 云存储系统之持久化

    本文来自博客园,作者:Arway,转载请注明原文链接:https://www.cnblogs.com/cenjw/p/16478717.html项目结构 . ├── db │ ├── file.go │ └── mysql │ └── conn.go ├── doc │ └── 建表语句.sql ├── go.mod ├── go.sum ├── han…

    2022/7/15 23:24:53 人评论 次浏览
  • node js 解压rar格式文件

    nodejs调用WinRAR解压var cp = require("child_process");function unZIP(winRarPath, password, zipFilePath, unZipFolder) {return new Promise(async (resolve, reject) => {cp.execFile(winRarPath, ["x", "-inul", `-p${password}…

    2022/7/14 1:22:42 人评论 次浏览
扫一扫关注最新编程教程