Questions tagged [go-gin]

Gin is a HTTP web framework written in Go.

It features a Martini-like API with much better performance -- up to 40 times faster. If you need smashing performance, get yourself some Gin.

Docs

GitHub

755 questions
-2
votes
1 answer

How to communicate between gin and Python

Here is my Go gin code: package main import ( "fmt" "github.com/gin-gonic/gin" ) type Data struct { Test string `json:"test"` } func getData(c *gin.Context) { var data Data err := c.BindJSON(&data) if err != nil { …
Bussiere
  • 500
  • 13
  • 60
  • 119
-2
votes
2 answers

How I will do load test(vegeta) for multiple methods multiple in golang

Suppose I have an api having two routes one is for saving the user and another one is for getting the user given below:- router.go package main import ( "github.com/gin-gonic/gin" "go-training/postAPI/controller" ) type Route struct { …
misha
  • 139
  • 1
  • 3
  • 14
-2
votes
1 answer

Set up a Go+Gin server and under load it's getting 13s response times

Update: Answered question with results from the web server hosted on VPS (Vultr) I compared it against a NodeJS/Express server to achieve a point of comparison. What have I done wrong? Go server: package main import "github.com/gin-gonic/gin" func…
David Alsh
  • 6,747
  • 6
  • 34
  • 60
-2
votes
2 answers

Errors Getting polls by id from mongoDB with go-gin and mgo

How do i query polls by id with go-gin and MongoDB, i have tried several methods but i still get errors (not found), can't seem to find a walk around below is my code, with my database on mongoDB: type Poll struct { //ID string…
Tech-P
  • 1
  • 2
-3
votes
1 answer

How to check if a reference is null or not

I have a function that creates an order. I need to know the Ogrn field is null or not. How should I do it? Func: func CreateOrder(c *gin.Context) { var order models.Order var form models.Form if &form.Ogrn == nil { ... } else…
Casper
  • 173
  • 2
  • 11
-3
votes
2 answers

Not able to get the keys of a Map even though gin's Context struct has Header as Map

I'm not able to get all the keys from Gin's Context.Header (Golang's gin-gonic http/rest framework) field, even though Header is defined as a Map "type Header map[string][]string" (Header is from net\http\Header.go, request is from…
-3
votes
1 answer

Not able to compile simple project in Goland

While executing a very simple project in Goland IDE, I see following errors. Tried setting GO111MODULE=on/off/auto.. Didn't make any difference!! Any idea? Logs: GOROOT=/usr/local/go #gosetup GOPATH=/Users//Documents/workspace/
ios_mxe
  • 115
  • 2
  • 12
-3
votes
1 answer

Copy field values from one type to instance of another type in list

Assume I have 2 structs as such: type Contract struct { Id string `json:"id" gorm:"column:uuid"` Name string `json:"name" gorm:"column:name"` Description string `json:"descr" gorm:"column:descr"` …
sgerbhctim
  • 3,420
  • 7
  • 38
  • 60
-3
votes
2 answers

How should I switch based on the URL

This is my URL in Postman: http://localhost:8000/filter?Name=Srinu I am passing a query string to fetch records on the database based on a query. In my database having Name, Gender, and Age, how should I write the switch statement based on the below…
srinu vas
  • 50
  • 6
-3
votes
1 answer

How to set cors setting

my project uses go-gin, and I tried setting cors When I submitted the following code, package middleware import ( "github.com/gin-contrib/cors" "github.com/gin-gonic/gin" ) func Use() { gin.SetMode(gin.ReleaseMode) cors.Default() …
jadejoe
  • 663
  • 2
  • 13
  • 24
-3
votes
1 answer

How to create multilevel map in golang

I have to send request parameter in json format to an API. This json request parameter is in nested format, so I am trying to create a map of request parameters and then convert it in json format and pass it to api. This is expected json format { …
Amit Upa
  • 307
  • 1
  • 2
  • 13
-3
votes
1 answer

Panic: runtime error: invalid memory address or nil pointer dereference only on the GAE

I am working on the golang app using gin framework. Basically it just fetch the data from firestore as JSON. Localy it works perfectly but when I deploy it to the GAE (gcloud app deploy) there is no error during deployment but when access the page…
-3
votes
1 answer

why after I connect to sql server with library golang go-mssqldb, it prints ?

After I connect to sql server, it prints , what is wrong with my code or is there a problem with my connection to sql server because they just print ? Error screenshot: package main import ( "database/sql" "fmt" _…
-3
votes
1 answer

How to get the JSON data sent from ajax and parsing to variable

I use jquery to send ajax json data for golang web restful service. And want to parse the json data in my backend using golang. Here is simple javascript code: $.ajax({ url: "http://localhost:8080/persons", type: "POST", …
charles.cc.hsu
  • 689
  • 11
  • 15
-3
votes
1 answer

How to create Multidimensional Key Value array/slice in GoLang

I have a PHP script in which i'hv created some array formats (data structures) which i want to convert the same array structure using Golang. Below is the array structure of my PHP script $response['spf']['current_value'] = $spfValue; // this…
sabby
  • 41
  • 1
  • 5
1 2 3
50
51