-
MongoDB 批量更新和删除字段
批量更新 db.getCollection('order').update( {account_id:'abcd'}, {$set:{accou
2020-11-20, Views: 4832 , Topics: MongoDB
-
Spring Boot 整合多数据源
运行环境 Spring Boot 2.4.0 MySQL Oracle 配置文件 注意:必须使用jdbc-url,否则会报jdbcUrl is requir
2020-11-19, Views: 2135 , Topics: Spring Boot
-
Spring Boot NoClassDefFoundError: com/mongodb/connection/DefaultClusterFactory
问题 在Spring Boot 2.3.0中使用mongodb-driver-sync 3.8.0版本时,出现了DefaultClusterFactory类找不
2020-11-18, Views: 9038 , Topics: Spring Boot MongoDB
-
Spring Boot 不引入模板引擎加载 HTML 网页等资源
配置文件 最主要配置spring.mvc.static-path-pattern和spring.resources.static-locations位置。 sp
2020-11-17, Views: 2772 , Topics: Spring Boot HTML
-
Gradle 项目无法下载 jar 包
报错信息 * What went wrong: A problem occurred configuring root project 'MyApp'. >
-
Go 生成 CSV 文件
写入 f, err := os.Create("test.csv") if err != nil { log.Fatal(err) } defer f.
-
Go 操作 PostgreSQL
下载驱动 使用github.com/lib/pq驱动:https://github.com/lib/pq go get -u github.com/lib/pq
2020-11-10, Views: 4744 , Topics: Go PostgreSQL
-
Go 操作 MySQL
下载驱动 使用go-sql-driver/mysql驱动:https://github.com/go-sql-driver/mysql go get -u gi
-
Go go build 命令
查看帮助 go help build -p n 多核CPU并行编译构建。 -race 开启竞态检测。 -compile name 指定编译器gccgo或gc。默
2020-11-05, Views: 4587 , Topics: Go
-
Go 数组和切片
数组 func main() { // 创建数组,指定长度 // 类型为[5]int var arr1 [5]int arr1[
2020-11-04, Views: 2285 , Topics: Go
-
Go JSON Tag
Tag omitempty:空值、nil、数组或集合长度为0时,忽略该字段。 -:破折号,忽略该字段。 -,:将字段名改为-。 ,string:将int类型字
-
Go JSON 的序列化和反序列化
序列化 json.Marshal 结构体 Go设定结构体字段小写为不可导出,无法序列化不可导出字段。大写字段导出后JSON字符串也将大写,故使用struct t
-
Go 格式化时间 yyyy-MM-dd
特殊值 Go中并没有按照yyyyMMdd这样的格式,而是按照2006-01-02 15:04:05这个固定来格式化,分隔符可自定义。 20060102:得到的
2020-11-01, Views: 9181 , Topics: Go
-
Go 字符串与字节数组互相转换
[]byte() 字符串转字节数组 str := "Hello Golang" fmt.Println([]byte(str)) // [72 101 108
2020-10-31, Views: 5121 , Topics: Go
-
Go 在 Windows 上编译 Linux 版本
查看 Go 环境变量 操作系统 go env GOOS 架构 go env GOARCH CMD 编译 注意:Windows下set指令只在cmd下有效,无法在
2020-10-30, Views: 6059 , Topics: Go cmd PowerShell
-
Go 何时使用 new 和 make
make slice:切片 map:映射 chan:通道 new array:数组 struct:结构体 所有值类型:int、float等
2020-10-29, Views: 1809 , Topics: Go
-
Go 占用虚拟内存过高
问题 在Linux系统中使用top命令发现VIRT列占用了700M。 解答 Go内存分配器在虚拟内存中预留了一大块区域作为分配的地方。这块虚拟内存局部于具体的G
-
Go 中的指数符号 e
十的连乘 1e3 = 1000 1e6 = 1000000 5.6e20 = 5.6 * 1e20
2020-10-27, Views: 4602 , Topics: Go