stevenlee
stevenlee
插入数据 下面的代码演示了如何插入一条记录,可以看到我们操作的是struct对象,而不是原生的sql语句,最后通过调用Insert接口将数据保存到数据库。 o := orm.NewOrm() var user User user.Name = "zxxx" user.Departname = "zxxx" id, err := o.Insert(&user) if err == nil { fmt.Println(id) } 报错:Unresolved reference 'Departname' 根据Model struct定义,Departname是Userinfo的字段,而不是User的字段...
博主你好,首先感谢你写的教程,让我学到很多东西。 图片上传功能好像在教程里没有写吧?有空能否加上呢?非常期待啊!
关于测试方法
首先说明下,如果没有获取token,提交POST请求的时候没有添加token参数,会提示{"code":400,"data":null,"msg":"请求参数错误"} 比如:curl -X POST 'http://127.0.0.1:8000/api/v1/articles?tag_id=1&title=test1&desc=test-desc&content=test-content&created_by=test-created&state=1&cover_image_url=http://www.baidu.cn' 1.首先获取token curl -X GET 'http://127.0.0.1:8000/auth?username=test&password=test123' {"code":200,"msg":"ok","data":{"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6IjA5OGY2YmNkNDYyMWQzNzNjYWRlNGU4MzI2MjdiNGY2IiwicGFzc3dvcmQiOiJjYzAzZTc0N2E2YWZiYmNiZjhiZTc2NjhhY2ZlYmVlNSIsImV4cCI6MTU3Mjk1NDUwMiwiaXNzIjoiZ2luLWJsb2cifQ.RvRDDP5DCscdsDFex31S6LyH6iAhWUIwTZU_nZEtJXc"}} 2.添加tag curl -X POST 'http://127.0.0.1:8000/api/v1/tags?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6IjA5OGY2YmNkNDYyMWQzNzNjYWRlNGU4MzI2MjdiNGY2IiwicGFzc3dvcmQiOiJjYzAzZTc0N2E2YWZiYmNiZjhiZTc2NjhhY2ZlYmVlNSIsImV4cCI6MTU3Mjk1NDUwMiwiaXNzIjoiZ2luLWJsb2cifQ.RvRDDP5DCscdsDFex31S6LyH6iAhWUIwTZU_nZEtJXc&name=tim&state=1&created_by=tim' {"code":200,"msg":"ok","data":null} 数据库里blog_tag表会插入一行数据 3.使用添加的tag_id 添加article curl -X POST 'http://127.0.0.1:8000/api/v1/articles?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6IjA5OGY2YmNkNDYyMWQzNzNjYWRlNGU4MzI2MjdiNGY2IiwicGFzc3dvcmQiOiJjYzAzZTc0N2E2YWZiYmNiZjhiZTc2NjhhY2ZlYmVlNSIsImV4cCI6MTU3Mjk1NDUwMiwiaXNzIjoiZ2luLWJsb2cifQ.RvRDDP5DCscdsDFex31S6LyH6iAhWUIwTZU_nZEtJXc&tag_id=3&title=golanglearning&desc=study&content=gogogo&created_by=lee&state=1&cover_image_url=http://www.baidu.cn' {"code":200,"msg":"ok","data":null} 4.获取article curl -X GET 'http://127.0.0.1:8000/api/v1/articles?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6IjA5OGY2YmNkNDYyMWQzNzNjYWRlNGU4MzI2MjdiNGY2IiwicGFzc3dvcmQiOiJjYzAzZTc0N2E2YWZiYmNiZjhiZTc2NjhhY2ZlYmVlNSIsImV4cCI6MTU3Mjk1NDUwMiwiaXNzIjoiZ2luLWJsb2cifQ.RvRDDP5DCscdsDFex31S6LyH6iAhWUIwTZU_nZEtJXc'...
cat /etc/redhat-release CentOS Linux release 7.2.1511 (Core) Kubernetes version v1.16.15 When I type the following command: kubectl-trace run node/node1 -f tcpconnect.bt (https://github.com/iovisor/bpftrace/blob/master/tools/tcpconnect.bt) trace e7bf7257-8d7f-4003-b035-fb47b553b978 created kubectl-trace logs e7bf7257-8d7f-4003-b035-fb47b553b978 if your...
my marathon version is:Version 1.4.5 and Version 0.13.0 marathon-lb version is :v1.11.2(latest) that's my marathon(Version 0.13.0) json { "id": "marathon-lb", "cpus": 8, "mem": 4096, "disk": 1000, "instances": 1, "container": {...
Currently I use Mesos_exporter expose mesos-slave metrics and through prometheus pull data, but I really do not know how to monitor specific container's network usage?
 http://mesosphere.github.io/mesos-dns can't access ? response 404
The version of mesos is now 1.9, and the /state interface has changed. When will the stable version of mesos-dns be released ?
### Current Behavior when i perform python script: ```python #!/usr/bin/python3 # coding: utf-8 # save this file as test-ssl.py import sys # sudo pip install requests import requests if len(sys.argv)
I add a id: "python-docker" with cmd python -m SimpleHTTPServer 8090 1. access my bamboo: http://10.10.10.2:8000/app-group/app1 2. access my haproxy directly: http://10.10.10.2/app-group/app1 If it is the first case: shows 404...