representing zones time go

Go反射终极指南:从基础到高级全方位解析

在本文中,我们将全面深入地探讨Go语言的反射机制。从反射的基础概念、为什么需要反射,到如何在Go中实现反射,以及在高级编程场景如泛型编程和插件架构中的应用,本文为您提供一站式的学习指南。 关注【TechLeadCloud】,分享互联网架构、云服务技术的全维度知识。作者拥有10+年互联网服务架构、AI ......
终极 全方位 基础 指南

Go - Setting Up and Tearing Down Before and After Tests

Problem: You want to set up data and an environment for testing and tear it down after the test is run. Solution: You can create helper functions or u ......
and Setting Tearing Before After

go封装数据库连接池

package mainimport ( "errors" "fmt" "gorm.io/driver/mysql" "gorm.io/gorm")// DBConfig 定义一个DBConfig结构体,用于存储数据库连接的配置信息,包括主机地址、端口、用户名、密码和数据库名type DBConfi ......
数据库 数据

go语言使用单例模式封装数据库连接池

package singledb import ( "gorm.io/driver/mysql" "gorm.io/gorm" "sync" ) // 数据库连接对象只有一个 var ( db *gorm.DB Once sync.Once //只执行一次某个操作的机制 ) func GetDbIn ......
语言 模式 数据库 数据

Go 提取字符串中url,转换为markdown格式并替换

Go 提取字符串中url,转换为markdown格式并替换 // MakeContentUrlToMarkDown 将字符串中url非markdown格式转[](url)格式 func MakeContentUrlToMarkDown(sourceString string) (resultStri ......
字符串 字符 markdown 格式 url

Go - Making an HTTP Client Request

Problem: You want to make an HTTP request to a web server. Solution: Use the net/http package to make an HTTP request. HTTP is a request - respond pro ......
Request Client Making HTTP Go

菜鸡go后端开发学习笔记1

首先了解项目内容及对应的人员:重要的是产品以及前端。 1、了解项目,理清逻辑,有什么不通顺的地方不清楚的地方及时的与产品进行沟通。 2、在写请求时,主要是前端发送请求给到后端,后端通过逻辑处理获取数据库里面对应的数据,并返回数据。所以请求字段和前端是有交互的,和前端约定接口:请求的路径、请求的方式、 ......
笔记

Go - Using Templates for Go Web Applications

Problem: You want to use Go’s templating system to create a web application. Solution: Use the html/template package to create a web application. pack ......
Applications Templates Using Go for

Go - Serving Through HTTPS

Problem: You want to serve your web application through HTTPS. Solution: Use the http.ListenAndServeTLS function to serve your web application through ......
Serving Through HTTPS Go

从内存使用角度的比较:Go vs Rust

Go和Rust是最近几年非常火的语言,经常有人问到底该怎么选择,特别是谁更适合搭建网络后台服务,哪一个性能更好,稳定性更高。 网络上Go和Rust的比较文章很多,大体上是做一个测试或写几段测试代码,根据运行的时长来比较哪个性能更好,但这种测试可能会陷入误区: 1)比来比去,比的是网络IO,因为这种测 ......
角度 内存 Rust vs

Go - Creating a JSON Web Service API

Problem: You want to create a simple web service API that returns JSON. Solution: Use the net/http package to create a web service API and the encodin ......
Creating Service JSON API Web

Go - Serving Static Files

Problem: You want to serve static files such as images, CSS, and JavaScript files. Solution: Use the http.FileServer function to serve static files. f ......
Serving Static Files Go

用go封装和实现扫码登录

本篇会讲讲token-go扫码登录的封装和实现,给库/框架增加新的功能,最后说明使用方法,源码:https://github.com/weloe/token-go ......

使用go语言开发hive导出工具

前言 新版 hive 提供了 beeline 工具,可以执行SQL并导出数据,不过操作还是有点复杂的,团队里有些同学不会Linux的基本操作,所以我花了亿点点时间写了个交互式的命令行工具方便使用。 效果 命令行工具,就是这么朴实无华。 探索过程 一开始是打算用 bash 脚本,结果发现根本不会写,b ......
语言 工具 hive

【转】,接上面3篇.Implement Sql Database Driver in 100 Lines of Go

原文: https://vyskocil.org/blog/implement-sql-database-driver-in-100-lines-of-go/ Implement Sql Database Driver in 100 Lines of Go 2019.02.18 Go databas ......
Implement Database Driver Lines 100

go 语言 == 引用判断和对象判断的区别

引用判断:只是判断内存地址是不是一样的。 a := []int{1, 2, 3} b := a c := make([]int, len(a)) copy(c, a) fmt.Println(a == b) // true,因为它们引用相同的内存地址 fmt.Println(a == c) // t ......
对象 语言 go

Go - Uploading a File to a Web Application

Problem: You want to upload a file to a web application. Solution: Use the net/http package to create a web application and the io package to read the ......
Application Uploading File Web Go

Go - Handling HTML Forms

Problem: You want to process data submitted from HTML forms. Solution: Use the Form field of http.Request or the FormValue method to access the data s ......
Handling Forms HTML Go

【转载】How to solve the problem that getting timestamp from Mysql database is 8 hours earlier than the normal time

This article introduces the relevant knowledge of "how to solve the problem of obtaining timestamp from Mysql database 8 hours earlier than the normal ......
the timestamp database problem getting

Go - Handling HTTP Requests

Problem: You want to process HTTP requests and send back HTTP responses. Solution: Use http.Request to extract information on HTTP requests and http.R ......
Handling Requests HTTP Go

Go - Creating a Simple Web Application

Problem: You want to create a simple web application that responds to an HTTP request and sends back an HTTP response. Solution: Use the net/http pack ......
Application Creating Simple Web Go

Go - Creating a UDP Client

Problem: You want to create a UDP client to send data to a UDP server. Solution: Use the Dial function in the net package to connect to a UDP server. ......
Creating Client UDP Go

《Mastering the FreeRTOS Real Time Kernel》读书笔记(7)事件组

FreeRTOS事件组,总而言之就是很多个二进制信号量的集合,通过使用掩码的方式提取每一位,使多个任务共同合作实现比较复杂的功能。 ......
Mastering FreeRTOS 事件 笔记 Kernel

client-go实战之七:准备一个工程管理后续实战的代码

欢迎访问我的GitHub 这里分类和汇总了欣宸的全部原创(含配套源码):https://github.com/zq2599/blog_demos 本篇概览 本文是《client-go实战》系列的第八篇,主要内容是新建一个golang工程,用于管理代码,后面整个系列的代码都会保存在这个工程中 工程结构 ......
实战 工程管理 client-go 代码 client

《Mastering the FreeRTOS Real Time Kernel》读书笔记(6)资源管理

7.资源管理(互斥量) 在多任务系统中,如果一个任务开始访问资源,但在从运行状态转换出来之前没有完成访问,则可能会出现错误。如果任务使资源处于不一致状态,则任何其他任务或中断对同一资源的访问都可能导致数据损坏或其他类似问题。 这里的资源管理,应该是指计算机的外设资源,比如LCD显示器,寄存器,内存中 ......

Go - Creating a TCP Client

Problem: You want to create a TCP client to send data to a TCP server. Solution: Use the Dial function in the net package to connect to a TCP server. ......
Creating Client TCP Go

《Mastering the FreeRTOS Real Time Kernel》读书笔记(5)中断管理

6.中断管理 在读这一章之前一直有一些疑惑,FreeRTOS中的中断是软中断吗,还是将外部硬中断的触发后,导入FreeRTOS的内部进行调度处理。如果是第一种,软中断和第三章讲的任务有区别吗,还是只是优先级比所有任务高。如果是第二种的话,外部中断的服务函数是不是不能写内容了,FreeRTOS的运行和 ......
Mastering FreeRTOS 笔记 Kernel Real

Go - Creating a TCP Server

Problem: You want to create a TCP server to receive data from a TCP client. Solution: Use the Listen function in the net package to listen for connect ......
Creating Server TCP Go

GO语言中的结构体

结构体创建、访问与修改 定义结构体 type user struct { id int score float32 enrollment time.Time name, addr string //多个字段类型相同时可以简写到一行里 } 声明和初始化结构体 var u user //声明,会用相应类 ......
语言 结构

GO语言中面向接口编程

接口的基本概念 接口是一组行为规范的集合。 type Transporter interface { //定义接口。通常接口名以er结尾 //接口里面只定义方法,不定义变量 move(src string, dest string) (int, error) //方法名 (参数列表) 返回值列表 w ......
接口 语言