You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: en/eBook/05.6.md
+9-9Lines changed: 9 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,12 @@
1
1
# 5.6 NoSQL database
2
2
3
-
A NoSQL database provides a mechanism for storage and retrieval of data that use looser consistency models than relational database in order to achieve horizontal scaling and higher availability. Some authors refer to them as "Not only SQL" to emphasize that some NoSQL systems do allow SQL-like query language to be used.
3
+
A NoSQL database provides a mechanism for the storage and retrieval of data that uses looser consistency models than typical relational databases in order to achieve horizontal scaling and higher availability. Some authors refer to them as "Not only SQL" to emphasize that some NoSQL systems do allow SQL-like query languages to be used.
4
4
5
-
As the C language of 21st century, Go has good support for NoSQL databases, and the popular NoSQL database including redis, mongoDB, Cassandra and Membase.
5
+
As the C language of the 21st century, Go has good support for NoSQL databases, including the popular redis, mongoDB, Cassandra and Membase NoSQL databases.
6
6
7
7
## redis
8
8
9
-
redis is a key-value storage system like Memcached, it supports string, list, set and zset(ordered set) as it's value types.
9
+
redis is a key-value storage system like Memcached, that supports the string, list, set and zset(ordered set) value types.
10
10
11
11
There are some Go database drivers for redis:
12
12
@@ -15,11 +15,11 @@ There are some Go database drivers for redis:
Let's see how to use the driver that I forked to operate database:
22
+
Let's see how to use the driver that I forked to operate on a database:
23
23
24
24
package main
25
25
@@ -52,17 +52,17 @@ Let's see how to use the driver that I forked to operate database:
52
52
client.Del("l")
53
53
}
54
54
55
-
We can see that it's quite easy to operate redis in Go, and it has high performance. Its client commands are almost the same as redis built-in commands.
55
+
We can see that it's quite easy to operate redis in Go, and it has high performance. Its client commands are almost the same as redis' built-in commands.
56
56
57
57
## mongoDB
58
58
59
59
mongoDB (from "humongous") is an open source document-oriented database system developed and supported by 10gen. It is part of the NoSQL family of database systems. Instead of storing data in tables as is done in a "classical" relational database, MongoDB stores structured data as JSON-like documents with dynamic schemas (MongoDB calls the format BSON), making the integration of data in certain types of applications easier and faster.
60
60
61
61

62
62
63
-
Figure 5.1 MongoDB compares to Mysql
63
+
Figure 5.1 MongoDB compared to Mysql
64
64
65
-
The best driver for mongoDB is called `mgo`, and it is possible to be in the standard library in the future.
65
+
The best driver for mongoDB is called `mgo`, and it is possible that it will be included in the standard library in the future.
66
66
67
67
Here is the example:
68
68
@@ -104,7 +104,7 @@ Here is the example:
104
104
fmt.Println("Phone:", result.Phone)
105
105
}
106
106
107
-
We can see that there is no big different to operate database between mgo and beedb, they are both based on struct, this is what Go style is.
107
+
We can see that there are no big differences when it comes to operating on mgo or beedb databases; they are both based on structs. This is the Go way of doing things.
In this chapter, you first learned the design of `database/sql` interface, and many third-party database drivers for different kinds of database. Then I introduced beedb to you, an ORM for relational databases, also showed some samples for operating database. In the end, I talked about some NoSQL databases, I have to see Go gives very good support for those NoSQL databases.
3
+
In this chapter, you first learned about the design of the `database/sql` interface and many third-party database drivers for various database types. Then I introduced beedb, an ORM for relational databases, to you. I also showed you some sample database operations. In the end, I talked about a few NoSQL databases. We saw that Go provides very good support for those NoSQL databases.
4
4
5
-
After read this chapter, I hope you know how to operate databases in Go. This is the most important part in web development, so I want to you completely understand design ideas of `database/sql` interface.
5
+
After reading this chapter, I hope that you have a better understanding of how to operate databases in Go. This is the most important part of web development, so I want you to completely understand the design concepts of the`database/sql` interface.
6
6
7
7
## Links
8
8
9
9
-[Directory](preface.md)
10
10
- Previous section: [NoSQL database](05.6.md)
11
-
- Next section: [Data storage and session](06.0.md)
11
+
- Next section: [Data storage and session](06.0.md)
0 commit comments