Questions tagged [beego]

Beego is an open-source, high-performance, modular, full-stack web framework for the Go programming language.

Beego is a Web framework for rapid development of Go applications. It can be used to develop APIs, web apps and backend services quickly. It is a RESTful framework. It is inspired by Tornado, Sinatra and Flask and has integrated some of Go-specific features such as interfaces and struct embedding.

Features

  • RESTful support
  • MVC architecture
  • Modularity
  • Auto API documents
  • Annotation router
  • Namespace
  • Powerful development tools
  • Full stack for Web & API

Useful links

Official documentation

Github repo

Beego community

Beego Books

285 questions
2
votes
1 answer

How to pass JSON response in Go BeeGo framework?

I'm building microservices app with go and beego. I'm trying to pass JSON response from service A to service B as following: func (u *ServiceController) GetAll() { req := httplib.Get("http://localhost/api/1/services") str, err :=…
wizard
  • 583
  • 2
  • 9
  • 26
2
votes
3 answers

MySQL's bit type maps to which Go type?

I used Java before, so some columns' type in database table is bit(1). But now I want to use beego to rebuild my project and I don't want to alter my database table (need do much). I use beego's orm in my project. So which Go type should I…
JICHUN
  • 103
  • 3
  • 9
2
votes
1 answer

Beego range in view templates

I have an integer having value 5 and i want to loop against it and populate a dropdown as following using range or for loop in html. can any one help me how to do that 1
2
votes
0 answers

bee migrate command not working

I am getting following error while running migrations. It was working fine. But when I dropped and created database again It is giving following error now. $ bee migrate -driver="postgres"…
Pandurang Waghulde
  • 995
  • 1
  • 6
  • 19
2
votes
1 answer

Passing a global reference to beego controllers

I'm trying to pass a logger reference initialised inside main.go to Controller layer via the router like bellow main.go logger, _ := zap.NewProduction() defer logger.Sync() // flushes buffer, if any sugar :=…
Anuruddha
  • 3,187
  • 5
  • 31
  • 47
2
votes
1 answer

Can't find templatefile

I have a beego project in IdeaProject. The structure is like this: MathApp ├── conf │ └── app.conf ├── main.go ├── main_test.go └── views ├── invalid-route.html └── result.html However, it shows the error can't find templatefile in the…
Yi Luo
  • 153
  • 2
  • 15
2
votes
2 answers

Use Sentry with Beego

I've been using Sentry in my Python projects, recently I started a project with Go and Beego framework and I need to configure Sentry for bug reports in my project. But after reading Beego documentation I couldn't find a proper way to do it. Please…
hamidfzm
  • 4,595
  • 8
  • 48
  • 80
2
votes
1 answer

What is correct way to handle form submission in beego?

I'm trying to submit form data in beego and store it to database. And have some questions: how correct handle request and transform it to object? Should I validate request or transformed object? My controller action: func (c *ServicesController)…
Oleksandr Savchenko
  • 642
  • 3
  • 10
  • 35
2
votes
1 answer

Is it possible to use multiple annotations in beego?

I have model like: type Service struct { Id uint64 Name string Secret string Disabled bool } And want to use annotations like form, valid and orm. And I can't find how I should declare these annotations. Should it be…
Oleksandr Savchenko
  • 642
  • 3
  • 10
  • 35
2
votes
0 answers

LoadRelated of a list in beego

I am wondering how the correct approach is to load related fields in beego. The doc explains it like this: type User struct { Id int Name string Posts []*Post `orm:"reverse(many)"` } user := User{Id: 1} err := dORM.Read(&user) num,…
Max
  • 21
  • 3
2
votes
2 answers

this.input.get() not working beego

1package main import ( "database/sql" "flag" "fmt" "github.com/astaxie/beego" ) type User struct { username string password string }type MainController struct { beego.Controller } func (this *MainController) Post()…
gophervk
  • 67
  • 8
2
votes
0 answers

Beego Router Nomatch - 404

My project was created using bee api appname [ bee api xxabc ] and everything was running fine. Due to some reason had to rename the project to xx-def and changing all the imports to the new renamed package "github.com/username/xx-def/controllers"…
souravlahoti
  • 716
  • 2
  • 8
  • 29
2
votes
1 answer

Beego Session Not Passing Data to Template Automatically

Upon getting session information of type map[string]interface{} with this.GetSession("session_key"), I did have to explicitly set the context and type assert the session like this in order to explicitly pass the data to the template. // Get the…
Pandemonium
  • 7,724
  • 3
  • 32
  • 51
2
votes
1 answer

beego template value range executing "content" not a field of struct type

in my controller i set the following data: c.Data["foos"] = foos and c.Data["user"] = user So if I ask some property from user in the view, all fine. {{if .user.IsSuperUser}} ID Username {{end}} But in: {{range…
user1644033
  • 277
  • 5
  • 17
2
votes
2 answers

get image and upload/save it in server location

I have an beego application in which i have a requirement of uploading a image from client for to server location. //Till now I have tried the following script $("#fileupload").on("click",function(){ $("#my_file").click(); userImage =…
vkc
  • 83
  • 1
  • 1
  • 9