mirror of
https://github.com/Estom/notes.git
synced 2026-12-01 00:38:27 +08:00
任务
This commit is contained in:
@@ -51,8 +51,7 @@ Go号称兼备C++的运行效率和PHP的开发效率,但benchmarks好像并
|
||||
|
||||

|
||||
|
||||
### go mieyou de texing
|
||||
### go去掉的内容
|
||||
Go项目包括编程语言本身,附带了相关的工具和标准库,最后但并非代表不重要的是,关于简洁编程哲学的宣言。就事后诸葛的角度来看,Go语言的这些地方都做的还不错:拥有自动垃圾回收、一个包系统、函数作为一等公民、词法作用域、系统调用接口、只读的UTF8字符串等。但是Go语言本身只有很少的特性,也不太可能添加太多的特性。例如,它没有隐式的数值转换,没有构造函数和析构函数,没有运算符重载,没有默认参数,也没有继承,没有泛型,没有异常,没有宏,没有函数修饰,更没有线程局部存储。但是,语言本身是成熟和稳定的,而且承诺保证向后兼容:用之前的Go语言编写程序可以用新版本的Go语言编译器和标准库直接构建而不需要修改代码。
|
||||
|
||||
## 2 从C的角度理解Go
|
||||
|
||||
|
||||
20
Go/test/1.go
20
Go/test/1.go
@@ -1,14 +1,18 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"fmt"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func main() {
|
||||
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||
fmt.Fprintf(w, "Hello, you've requested: %s\n", r.URL.Path)
|
||||
})
|
||||
func main(){
|
||||
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||
fmt.Fprintf(w, "Hello, you've requested: %s\n", r.URL.Path)
|
||||
})
|
||||
|
||||
http.ListenAndServe(":80", nil)
|
||||
}
|
||||
http.ListenAndServe(":80", nil)
|
||||
|
||||
file, err := os.Create("writeAt.txt")
|
||||
if err != nil { panic(err) }
|
||||
defer file.Close() file.WriteString("Golang中文社区——这里是多余") n, err := file.WriteAt([]byte("Go语言中文网"), 24) if err != nil { panic(err) } fmt.Println(n)
|
||||
}
|
||||
|
||||
36
Go/test/format.go
Normal file
36
Go/test/format.go
Normal file
@@ -0,0 +1,36 @@
|
||||
type RawBytes
|
||||
type Result
|
||||
type DB
|
||||
func Open(driverName, dataSourceName string) (*DB, error)
|
||||
func (db *DB) Driver() driver.Driver
|
||||
func (db *DB) Ping() error
|
||||
func (db *DB) Close() error
|
||||
func (db *DB) SetMaxOpenConns(n int)
|
||||
func (db *DB) SetMaxIdleConns(n int)
|
||||
func (db *DB) Exec(query string, args ...interface{}) (Result, error)
|
||||
func (db *DB) Query(query string, args ...interface{}) (*Rows, error)
|
||||
func (db *DB) QueryRow(query string, args ...interface{}) *Row
|
||||
func (db *DB) Prepare(query string) (*Stmt, error)
|
||||
func (db *DB) Begin() (*Tx, error)
|
||||
type Row
|
||||
func (r *Row) Scan(dest ...interface{}) error
|
||||
type Rows
|
||||
func (rs *Rows) Columns() ([]string, error)
|
||||
func (rs *Rows) Scan(dest ...interface{}) error
|
||||
func (rs *Rows) Next() bool
|
||||
func (rs *Rows) Close() error
|
||||
func (rs *Rows) Err() error
|
||||
type Stmt
|
||||
func (s *Stmt) Exec(args ...interface{}) (Result, error)
|
||||
func (s *Stmt) Query(args ...interface{}) (*Rows, error)
|
||||
func (s *Stmt) QueryRow(args ...interface{}) *Row
|
||||
func (s *Stmt) Close() error
|
||||
type Tx
|
||||
func (tx *Tx) Exec(query string, args ...interface{}) (Result, error)
|
||||
func (tx *Tx) Query(query string, args ...interface{}) (*Rows, error)
|
||||
func (tx *Tx) QueryRow(query string, args ...interface{}) *Row
|
||||
func (tx *Tx) Prepare(query string) (*Stmt, error)
|
||||
func (tx *Tx) Stmt(stmt *Stmt) *Stmt
|
||||
func (tx *Tx) Commit() error
|
||||
func (tx *Tx) Rollback() error
|
||||
func Register(name string, driver driver.Driver)
|
||||
Reference in New Issue
Block a user