上一页 1 ··· 64 65 66 67 68 69 70 71 72 ··· 179 下一页
摘要: 一,创建索引 CREATE FULLTEXT INDEX ft_content ON table_name (content) WITH PARSER ngram; 表名和字段可以用``表示引用 说明:创建全文索引时,如果不添加WITH PARSER ngram;有可能会检索不到结果 二,测试: 1 阅读全文
posted @ 2024-11-30 10:49 刘宏缔的架构森林 阅读(153) 评论(0) 推荐(0)
摘要: 一,代码 1,全局文件: // 日志消息结构体 type LogMessage struct { Level string Message string } //通道 var LogChan chan LogMessage //日志文件句柄 var GlobalLogFile *os.File // 阅读全文
posted @ 2024-11-30 10:48 刘宏缔的架构森林 阅读(97) 评论(0) 推荐(0)
摘要: 一,现象: 如果填写参数时使用的是params类型,而value中包含+,则此时的值在提交到线上时会被替换成空格,原因是:使用params类型参数和值会拼接在url中 二,解决: 在body标签下,使用form-data类型,此时的各项值不会被拼接到url中,+也就不会被替换成空格了 阅读全文
posted @ 2024-11-27 09:57 刘宏缔的架构森林 阅读(263) 评论(0) 推荐(0)
摘要: 一,代码: Unicode是为了解决传统的字符编码方案的局限而产生的,它为每种语言中的每个字符设定了统一并且唯一的二进制编码, 以满足跨语言、跨平台进行文本转换、处理的要求 package controller import ( "encoding/json" "fmt" "github.com/g 阅读全文
posted @ 2024-11-25 19:43 刘宏缔的架构森林 阅读(51) 评论(0) 推荐(0)
摘要: 一,代码: package main import ( "embed" "flag" "github.com/gofiber/template/html/v2" "net/http" "fmt" "runtime" "industry/config" "industry/routes" ) // 构 阅读全文
posted @ 2024-11-23 10:43 刘宏缔的架构森林 阅读(65) 评论(0) 推荐(0)
摘要: 一,官方网站: https://gorm.io/ 如图: 二,安装: 从命令行安装gorm $ go get -u gorm.io/gorm go: downloading gorm.io/gorm v1.25.12 go: downloading github.com/jinzhu/now v1. 阅读全文
posted @ 2024-11-23 09:18 刘宏缔的架构森林 阅读(247) 评论(0) 推荐(0)
摘要: 一,代码 1,模块 package page import "fmt" type Page struct { //定义分页的struct Total int `json:"total"` TotalPage int `json:"totalpage"` CurrentPage int `json:" 阅读全文
posted @ 2024-11-23 09:17 刘宏缔的架构森林 阅读(46) 评论(0) 推荐(0)
摘要: 一,代码 func main() { app := fiber.New() app.Static("/", "./public") // => http://localhost:3000/js/script.js // => http://localhost:3000/css/style.css a 阅读全文
posted @ 2024-11-23 09:15 刘宏缔的架构森林 阅读(66) 评论(0) 推荐(0)
摘要: 一,代码: 官网文档地址: https://docs.gofiber.io/api/middleware/session 1,全局变量 package config import ( "github.com/gofiber/fiber/v2/middleware/session" "github.c 阅读全文
posted @ 2024-11-23 09:06 刘宏缔的架构森林 阅读(55) 评论(0) 推荐(0)
摘要: 一,代码 说明: 1,中文字符串的长度: golang中string底层是通过byte数组实现的,所以直接求len,实际是在按字节长度计算。中文字符在unicode下占2个字节,在utf-8编码下占3个字节,而golang默认编码正好是utf-8。所以一个汉字占3个字节算了3个长度。所以打印长度为8 阅读全文
posted @ 2024-11-23 09:05 刘宏缔的架构森林 阅读(351) 评论(0) 推荐(0)
上一页 1 ··· 64 65 66 67 68 69 70 71 72 ··· 179 下一页