this repo have moved to beego/bee
please get bee use go get github.com/beego/bee
Bee is a tool for managing beego framework.
this repo have moved to beego/bee
please get bee use go get github.com/beego/bee
有时候测试环境,mysql用户名密码太复杂了,每次进入mysql命令行都要看到密码输入,可以增加一个像django 中在项目目录执行python manage.py dbshell
命令即可直接进入mysql等sql终端。
@astaxie
关于beego框架中数据表的一对多关系有个问题想请教一下,具体如下:
我现在有两张表,policy和rule,policy和rule时间是一对多的关系,model的定义如下:
type Policy struct {
Id int orm:"pk;auto"
Rules []*Rule orm:"reverse(many)"
ServiceInstanceId string orm:"size(64)"
Name string orm:"size(64)"
MinInstance int
MaxInstance int
StatisticWin int
BreachDur int
CooldownOut int
CooldownIn int
LastScaleoutTime time.Time
LastScaleinTime time.Time
}
type Rule struct {
Id int orm:"pk;auto"
Policy *Policy orm:"rel(fk)"
MetricType string orm:"size(16);"
ScaleOutThreshold int
ScaleOutUnit int
ScaleInThreshold int
ScaleInUnit int
}
现在http请求的body体的格式如下:
{
"Rules": [
{
"MtricType": "CPU",
"ScaleOutThreshold": 80,
"ScaleOutUnit": 1,
"ScaleInThreshold": 30,
"ScaleInUnit": 5
},
{
"MtricType": "Memory",
"ScaleOutThreshold": 80,
"ScaleOutUnit": 1,
"ScaleInThreshold": 30,
"ScaleInUnit": 1
}
],
"ServiceInstanceId": "fb41bf4a-89c6-4a73-9f3b-1f8957215a52",
"Name": "policy_1",
"MinInstance": 1,
"MaxInstance": 5,
"StatisticWin": 120,
"BreachDur": 300,
"CooldownOut": 300,
"CooldownIn": 300
}
现在我要解析body体,err := json.Unmarshal(this.Ctx.Input.RequestBody, &policy),最后执行policy的save,但是rule却没有更新,我看到policy和rule之间定义一对多的关系时,使用的是结构体指针的数组和结构体的指针,与body的格式不一样,请问如果我想解析出的policy带有rule的指针数组,并且save policy的时候不仅更新policy表,还更新相应的rule表,请问这样可以实现吗?
Hello,
I would like to create new project in $GOPATH/src/bitbucket.org/matrixik
sub-folder so that I could import controllers folder with
"bitbucket.org/matrixik/beehello/controllers"
instead of
"beehello/controllers"
Now I see error:
D:\Golibs\my\src\bitbucket.org\matrixik>bee create beehello
can't create application outside of GOPATH
you first should `cd $GOPATH/src` then use create
It's not not very high priority, after all I can create app in $GOPATH/src
, copy it to desired folder and update imports by hand.
Best regards,
Dobrosław Żybort
I'm having no trouble getting my first project up and running with beego, and I just started to test bee
for the hot update feature. But I seem to be having problems, where it does not restart the process, or auto rebuild. Maybe I am not doing correctly...
Platform: OSX
$ cd /path/to/my/src/myProject
$ ~/bin/bee start /path/to/my/src/myProject/myProject
/path/to/my/src/myProject/controllers
/path/to/my/src/myProject/models
start autobuild
build success
start /path/to/my/src/myProject/myProject
That launches the process and I can successfully use the exposed GET endpoints. But when I change any source code, I don't see it say it is rebuilding and restarting the process. And when I send it a SIGHUP, like in your README example, it simply kills the myProject process, leaving bee still running. I can no longer hit the GET endpoints anymore.
Am I running bee start
correctly? Should it be run from within the project directory, and passed the full path to the executable?
Error when executing this command
bee generate appcode -tables ...
error:
Could not query INFORMATION_SCHEMA for PK/UK/FK information
I would like to create an api application based on beego, but the bee reports the following error:
$ bee api westfoto
can't create application outside of GOPATH /Users/Red/Projects/gocode
you first should cd $GOPATH/src
then use create
I'm sure i'm in the $GOPATH/src dictionary. so please look into the code please.
刚接触golang,如果是比较2B的问题,还请见谅!
cd到代码目录,执行
go run main.go
得到以下错误:
# command-line-arguments
./main.go:59: undefined: cmdCreate
./main.go:60: undefined: cmdStart
请问有哪个步骤遗漏了?谢谢~
1.需要添加环境变量 gopath —— D:\Go\bin(安装完bee之后,bee.exe所在目录),不添加这个环境变量,就算是cd到当前目录也不可用。
2.需要新建目录:D:\Go\bin\src
然后就可以用了
我的GOROOT C:\GO
GOPATH : C:\Go\src\itfanr C:\Go\src\itfanr\pro1
C:\Go\src\github.com\astaxie\beego
C:\Go\src\itfanr\pro1 我的main.go在这个目录
在main.go中 "github.com/astaxie/beego" liteide和goeclipse都提示错误,根本无法编译,但是直接go run是可以的。。。
/usr/lib/go/src/pkg/github.com/astaxie/bee/pack.go:264: undefined: tar.FileInfoHeader
/usr/lib/go/src/pkg/github.com/astaxie/bee/pack.go:362: cw.Flush undefined (type *gzip.Writer has no field or method Flush)
why?
Hello,
just an idea:
maybe you can add option to pack all/most dependencies (folders: static
and views
) into one executable file.
bee pack [appname]
Some packages to check:
There also could be option to additionally pack app.conf
file
or
if beego could gain ability to have two config files (app.conf
and dev.conf
) it could pack app.conf
file by default.
Best regards,
Dobrosław Żybort
go get github.com/astaxie/bee
之后应该是路径原因创建了
C:\go\bin; 目录,并将 bee.exe拷贝到了该目录
应该是在处理环境变量时有点问题
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.