10 2022 档案

摘要:一. 表单验证的初始化 1. 定义forms验证 在forms目录下创建user.go文件 增加验证的struct内容 package forms type PassWordLoginForm struct { Mobile string `form:"mobile" json:"mobile" b 阅读全文
posted @ 2022-10-31 14:05 wanghhhh 阅读(157) 评论(0) 推荐(0) 编辑
摘要:1. 使用库viper 使用示例 package main import ( "fmt" "github.com/spf13/viper" ) type ServerConfig struct { ServiceName string `mapstructure:"name"` Port int ` 阅读全文
posted @ 2022-10-28 13:41 wanghhhh 阅读(227) 评论(0) 推荐(0) 编辑
摘要:1. 项目目录结构 2. 定义main函数 package main import ( "fmt" "go.uber.org/zap" "mxshop-api/user-web/initialize" ) func main() { //初始化logger initialize.InitLogger 阅读全文
posted @ 2022-10-28 09:55 wanghhhh 阅读(140) 评论(0) 推荐(0) 编辑
摘要:#!/usr/bin/env python # -*- coding: utf-8 -*- import os import signal import sys from concurrent import futures import logging from loguru import logg 阅读全文
posted @ 2022-10-26 16:03 wanghhhh 阅读(100) 评论(0) 推荐(0) 编辑
摘要:from passlib.hash import pbkdf2_sha256 # 生成md5 has = pbkdf2_sha256.hash('123456') print(has) # 校验 print(pbkdf2_sha256.verify("1234561", has)) 阅读全文
posted @ 2022-10-26 14:00 wanghhhh 阅读(65) 评论(0) 推荐(0) 编辑
摘要:package main import ( "context" "log" "net/http" "os" "os/signal" "syscall" "time" "github.com/gin-gonic/gin" ) func main() { router := gin.Default() 阅读全文
posted @ 2022-10-25 18:05 wanghhhh 阅读(217) 评论(0) 推荐(0) 编辑
摘要:1. 无中间件启动 #使用 r := gin.New() #替代 // 默认启动方式,包含 Logger、Recovery 中间件 r := gin.Default() 2. 中间件启动 func main() { // 创建一个不包含中间件的路由器 r := gin.New() // 全局中间件 阅读全文
posted @ 2022-10-25 16:09 wanghhhh 阅读(54) 评论(0) 推荐(0) 编辑
摘要:功能: 1. 对登录和注册表单进行验证 2. 对表单返回的错误进行中文翻译 3. 对表单返回的数据进行处理,大小写处理和切割 package main import ( "fmt" "net/http" "reflect" "strings" "github.com/gin-gonic/gin" " 阅读全文
posted @ 2022-10-25 14:33 wanghhhh 阅读(39) 评论(0) 推荐(0) 编辑
摘要:1. 输出json和protobuf 新建user.proto文件 syntax = "proto3"; option go_package = ".;proto"; message Teacher { string name = 1; repeated string course = 2; } g 阅读全文
posted @ 2022-10-25 11:48 wanghhhh 阅读(69) 评论(0) 推荐(0) 编辑

阅读目录(Content)

此页目录为空

点击右上角即可分享
微信分享提示