Go语言中文网 为您找到相关结果 3683

前端工程师吐后端工程师(第九讲)——最不擅长的数据库操作

第八讲中我们介绍了如果使用Gin写一些常用的接口,本讲我们主要介绍一下数据库如何操作。这一讲没有具体页面,可能对于前端工程师会不太习惯。首先我们要单件一个mysql数据库环境。如果不会的话可以参考这个教程https://www.jianshu.com/p/3a0de5da49f3,在搭建完成MySQL,并且启动MySQL之后。数据的管理员账户名设置成root,数据库密码设置为00000000。因为后续我们在代码中使用的数据库相关代码,会以这个为准.我们可以通过mysql -h 127.0.0.1 -P 3306 -u root -p 000000000 指令来连接刚刚搭建在本机上的数据库。127.0.0.1为本机IP,3306为数据库具体端口,root为数据库用户名,000000000为数据...阅读全文

博文 2020-01-08 19:32:47 陈辰CC老师

Graphqlator - A CLI program that generates a graphql-go server from an existing MySQL, MariaDB, or PostgresQL schema

<p>Hello Gophers,</p> <p>I&#39;m new here, been mostly lurking for the past few months. I&#39;ve written an open-source CLI tool that generates a GraphQL API server.</p> <p>It does this by connecting to your database instance and querying the <a href="https://dev.mysql.com/doc/refman/5.7/en/information...阅读全文

资源 2018-03-04 20:30:13 blov

The "VTable pattern" in Go

<p>I know I am not supposed to think about virtual functions when programming in Go. :&gt; However, recently I noticed that there is a &#34;code reuse via dynamic dispatch&#34; pattern lurking in some of my projects anyway, and so I took some time to extract it into a demo project to help myself re-execute the pattern should the n...阅读全文

资源 2018-03-12 13:30:13 agolangf

What pointer is for?

<p>Start with C++ for about a months then move entirely to C# and since the language I&#39;m dealing with doesn&#39;t have pointer (Javascript, Python, PHP....) I really don&#39;t know the point of pointer. Now I&#39;m learning Go because I want to program a distribute network. I searched for what is pointer and the answer doe...阅读全文

Go 语言学习笔记 -第4章复合数据类型

Go 语言学习笔记 -第4章 [toc] 复合数据类型 数组 Golang中操作数组或者序列化数据需要用到slice,程序中写作“[]" slice 指向数组的值,并且同时包含了长度信息 package main import "fmt" func main() { // list := []int{1, 2, 3, 4} list := [...]int{1, 2, 3, 4} fmt.Println(list) fmt.Printf("Type %T\n", list) for i := 0; i < len(list); i++ { fmt.Printf("list[%d]=%d\n", i, list[i]) } //重新切片s[low:high], low->(high-1) fm...阅读全文

博文 2020-01-09 15:32:41 Mark110

Docker基础(2) 实践篇

Docker基础(2) 实践篇 Docker的指令系统 全局指令 Docker仓库管理 Docker镜像管理 Dockerfile Docker容器管理 Docker Compose 命令的嵌套 Docker的指令系统 Docker指令的操作对象主要针对四个方面: 针对守护进程的系统资源设置和全局信息的获取。比如:docker info、docker deamon等。 针对Docker仓库的查询、下载操作。比如:docker search、docker pull等。 针对Docker镜像的查询、创建、删除操作。比如:docker images、docker build等。 针对Docker容器的查询、创建、开启、停止操作。比如:docker ps、docker run、docker star...阅读全文

博文 2020-03-02 01:32:39 zhixin9001

Auto-generating proxy objects

<p>So I&#39;m trying to generate proxy objects to wrap some existing objects. I&#39;d like to create proxies which add logging without having to write the logging in to each of my objects and method calls.</p> <p>I know I can do this by writing a proxy myself, but I have a lot of objects that I don&#39;t want to chan...阅读全文

资源 2018-01-17 14:30:13 blov

重新认识Go的Slice

开篇语 大多数时候我们都忘记了或者压根不知道slice是怎么工作的。大多数时候我们只是把slice当做动态数组来用。通过重新认识slice,我们可以一定程度上避免掉入slice的陷阱,并且更好的使用它。 参考资料有: Effective Go Go Slices: usage and internal 本文重点是代码例子,边动手边学习 回归本元: 什么是数组? Go中的数组(array)是一个固定大小的、单一类型的一个序列。 创建数组需要两个参数:size和type。 Array的size是类型的一部分 x := [5]int{1, 2, 3} y := [5]int{3, 2, 1} z := [5]int{1, 2, 3} fmt.Printf("x == y: %v\\n", x ==...阅读全文

博文 2020-03-23 19:32:46 麻瓜镇

What is the idiomatic way to consolidate sql queries in golang?

<p>I am working on a project that is growing in terms of the amount of people working on it and the amount of different queries we have to support. It seems people are just writing more and more separate queries. Although I am only a junior developer, I can foresee this becoming hard to maintain. What is usually the idiomatic way of consolida...阅读全文

资源 2017-05-11 09:00:08 blov