Giter Site home page Giter Site logo

golang-data-demo's Introduction

golang-data-demo

golang 构建数据服务 使用xorm

1.下载Docker

2.安装数据库

2.1.下载镜像

2.2 启动 mysql 作为主机服务

2.3 启动 mysql client 访问服务器

  • sudo docker run -it --rm --net host mysql:5.7 "sh" 启动了容器内 sh 进程。

      -it 等价于 -i -t ,表示使用当前 stdin 和 stdout 作为该进程的 io
      --rm , 当该进程结束时,自动清理该容器的文件系统空间
      --net host,表示容器使用当前主机的网络环境
      参数1 参数2,分别是镜像和在镜像中执行的命令
    
  • “#”表示你处于容器的超级管理员的 shell

  • mysql -h127.0.0.1 -P3306 -uroot -proot mysql 客户端的命令

3.创建数据库test

4.构建数据服务测试结果

基本代码与课件基本一致

4.1.测试web服务

添加数据

  • -d 参数是 POST 到服务器的数据

查询数据

4.2.ab测试结果

4.2.curl测试结果

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.