# 案例库 **Repository Path**: fzy1999/case-library ## Basic Information - **Project Name**: 案例库 - **Description**: 11111111111111111111111111111111111 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2023-03-30 - **Last Updated**: 2023-07-09 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 案例库 #### 介绍 {**以下是 Gitee 平台说明,您可以替换此简介** Gitee 是 OSCHINA 推出的基于 Git 的代码托管平台(同时支持 SVN)。专为开发者提供稳定、高效、安全的云端软件开发协作平台 无论是个人、团队、或是企业,都能够用 Gitee 实现代码托管、项目管理、协作开发。企业项目请看 [https://gitee.com/enterprises](https://gitee.com/enterprises)} #### 软件架构 软件架构说明 #### 安装教程 1. go 1.20 2. gcc 11.3.0 3. g++ 11.3.0 4. #### 使用说明 1. xxxx 2. xxxx 3. xxxx # Tutorial ## 参考资料 https://gopl-zh.github.io/ ## tutorial/1.helloworld ``` cd 1.helloworld go run hello.go ``` ## tutorial/2.Use_C_in_go_v1 ``` cd 2.Use_C_in_go_v1 go build main.go ./main ``` ## tutorial/3.Call_code_in_an_external_package https://golang.google.cn/doc/tutorial/getting-started When you need your code to do something that might have been implemented by someone else, you can look for a package that has functions you can use in your code. 1. Make your printed message a little more interesting with a function from an external module. 1. Visit pkg.go.dev and [search for a "quote" package](https://pkg.go.dev/search?q=quote). 2. Locate and click the `rsc.io/quote` package in search results (if you see `rsc.io/quote/v3`, ignore it for now). 3. In the **Documentation** section, under **Index**, note the list of functions you can call from your code. You'll use the `Go` function. 4. At the top of this page, note that package `quote` is included in the `rsc.io/quote` module. You can use the pkg.go.dev site to find published modules whose packages have functions you can use in your own code. Packages are published in modules -- like `rsc.io/quote` -- where others can use them. Modules are improved with new versions over time, and you can upgrade your code to use the improved versions. 2. In your Go code, import the `rsc.io/quote` package and add a call to its `Go` function. After adding the highlighted lines, your code should include the following: ``` package main import "fmt" import "rsc.io/quote" func main() { fmt.Println(quote.Go()) } ``` 3. Add new module requirements and sums. Go will add the `quote` module as a requirement, as well as a go.sum file for use in authenticating the module. For more, see [Authenticating modules](https://golang.google.cn/ref/mod#authenticating) in the Go Modules Reference. ``` $ go mod tidy go: finding module for package rsc.io/quote go: found rsc.io/quote in rsc.io/quote v1.5.2 ``` 4. Run your code to see the message generated by the function you're calling. ``` $ go run . Don't communicate by sharing memory, share memory by communicating. ``` Notice that your code calls the `Go` function, printing a clever message about communication. When you ran `go mod tidy`, it located and downloaded the `rsc.io/quote` module that contains the package you imported. By default, it downloaded the latest version -- v1.5.2. ## tutorial/4.Create_a_Go_module https://golang.google.cn/doc/tutorial/create-module ## tutorial/6.Cgo_static_library ``` cd tutorial/6.Cgo_static_library # 构建静态库 $ gcc -c foo.c -o foo.o $ ar rcs libfoo.a foo.o ``` ``` go run main.go ``` ## tutorial/7.Cgo_dynamic_library ``` cd tutorial/7.Cgo_dynamic_library ``` 构建动态库 ``` gcc -shared -fPIC -o libgreet.so greet.c ``` 第一种编译运行方法 ``` go build . ./7.Cgo_dynamic_library ``` 第二种编译运行方法 ``` go build main.go export LD_LIBRARY_PATH=/root/case-library/tutorial/7.Cgo_dynamic_library ./main ``` # tutorial/8.Developing a RESTful API with Go and Gin https://golang.google.cn/doc/tutorial/web-service-gin 启动数据库 sudo service mysql start 导入数据库数据 sudo mysql -uroot -p123456 < backup.sql 创建非root用户 sudo mysql -uroot -p123456 CREATE USER 'fzy'@'localhost' IDENTIFIED BY '123456'; GRANT ALL privileges ON case_library.* TO 'fzy'@'localhost' myqsl -uroot -p123456 初始化数据库 mysql 127.0.0.1 fzy 123456 case_library show databases; use case_library; show tables; select * from student_table; router->APi->model-> npm install @logicflow/extension npm install @logicflow/core npm install vue-color mysql 数据库名称 case_library 用户名 root 密码 123456 导出数据库 mysqldump -uroot -p123456 case_library > case_library.sql mysql -ugva -p123456 gva< case_library.sql docker-compose -f deploy/docker-compose/docker-compose.yaml up --build # 容器构建 ## 1. 构建镜像 docker-compose -f deploy/docker-compose/docker-compose.yaml up --build ## 2. 恢复数据库 ssh mysql cp case_LIBRARY.SQL mysql -ugva -p123456 gva< case_library.sql 再设置一下权限 ok