Questions tagged [golang-migrate]

golang-migrate is a database migration tool written in Go. Questions tagged golang-migrate should be directly related to database migrations in Go.

See https://github.com/golang-migrate/migrate

Database migrations written in Go. Use as CLI or import as library.

  • Migrate reads migrations from sources and applies them in correct order to a database.
  • Drivers are "dumb", migrate glues everything together and makes sure the logic is bulletproof. (Keeps the drivers lightweight, too.)
  • Database drivers don't assume things or try to correct user input. When in doubt, fail.
107 questions
-1
votes
1 answer

How to fix multiple-value stmt.Query() in single-value context

I am facing the above issue with the code below stmt, err2 := db.Prepare( "SELECT COUNT(*) FROM xyz WHERE product_id=? and chart_number=?") rows, err2 := stmt.Query( bidStatusReqVal.ProductId,bidStatusReqVal.ChartNumber).Scan(&count)
alsa
  • 9
  • 5
-1
votes
1 answer

File not exist when run mysql database migrations on windows

I cloned an existing repository (repository created by a team in my office which deals with subscriptions in a certain app we are working on) which have some database migration files inside the path ..\internal\db\migrations , this is migration…
Laila
  • 549
  • 1
  • 13
  • 30
-1
votes
1 answer

Golang keeps crashing on running main.go with exception Exception 0xc0000005

I am new to Golang and have developed a basic REST API using GIN and gorm. The API works fine and there are no errors in the code. The main.go file is below: package main import ( "fmt" "os" "github.com/gin-gonic/gin" …
Usman Ali
  • 21
  • 1
  • 5
-1
votes
1 answer

I have a table of users. I want to write an API that will grab data using id. I keep getting the below error. Mind you the database is already full

I have a table of users. I want to write an API that will grab data using id. I keep getting the below error. Mind you the database is already full. I want to create a get api where I pass the id and get that row as a result. I have tried a few…
Abhisek Roy
  • 582
  • 12
  • 31
-2
votes
0 answers

Need to fix the errors

[enter image description here](https://i.stack.imgur.com/Xv[enter image description here](https://i.stack.imgur.com/FdCei.jpg)qJp.jpg) I am trying to fix the errors in my application using golang but it's not coming, how can I fix it. Actually here…
Honey
  • 1
  • 1
-2
votes
1 answer

How to pass variable value to shell script from go?

shell.sh #!/bin/bash npx create-react-app --template typescript run.go func runScript(genErr *error) { if *genErr != nil { return } cmd := exec.Command("/bin/sh", "-c", shell) *genErr =…
-2
votes
1 answer

How to Ignore database columns not specified in the struct

I have mentioned two fields(Name, Age) in my golang Struct after few days I have added one more fields in my database(Name,Age, Salary ) not in golandg struct.It shows errors like(Error 1364: Field 'salary' doesn't have a default value). How to…
-2
votes
1 answer

I have got panic: runtime error: invalid memory address or nil pointer dereference in Golang

panic: runtime error: invalid memory address or nil pointer dereference when i add statusCOD, err := c.route.FindStatusCODByOrigin(ctx, req.Origin) if err != nil { if err != sql.ErrNoRows { …
-2
votes
2 answers

Golang REST API PUT and DELETE request doest work when calling from HTML page using Javascript

I am trying to write a REST API in Go, all the methods are working fine when I run through postman, but when calling the PUT and Delete methods from the HTML page using JAVA Script function it's not working. Are there any alternatives for the…
Chikku Jacob
  • 2,114
  • 1
  • 18
  • 33
-2
votes
2 answers

how do i import packages in go-lang or how to structure correctly package structure?

I have following folder structure here server -main.go -cmd -config -config.go -handlerr.go -handlers -handlers.go -pkg -models -models.go…
Kudi
  • 11
  • 4
-2
votes
1 answer

Declarate and using map in structs

I'am so very noob in golang and started only a fews days ago. Actually I'm trying make a simple exercise for get used to the golang syntax. I have this in main.go: package main import( "fmt" // "stringa" "main/survey" ) func main() { …
vfbraton
  • 83
  • 1
  • 6
-2
votes
2 answers

Is it wrong duplicate "func main" in "package main" and why it is wrong?

Please help me to understand why duplicate "func main" in "package main" is wrong. Error in VC: "main redeclared in this block". // $ tree // . // ├── main.go // ├── second.go // ```go build main.go``` // or // ```go build .``` // file:…
Roman
  • 49
  • 2
  • 6
-2
votes
2 answers

Installation Issues on MacOS

I just came to know about Go and I installed it from here for MacOS, it went well but when I tried to setup my go workspace "https://golang.org/doc/install#macos" i followed this tutorial: https://www.youtube.com/watch?v=5qI8z_lB5Lw, But after…
-2
votes
1 answer

How can connect Golang and Android with socket.io ?

I want to send data from Android to Golang with socket.io . I do that with Nodejs correctly But now , i want do with Go. I cant find simple example.how can i do that?
m-tech
  • 338
  • 2
  • 14
-3
votes
1 answer

how to sort this type go lang

common": [ { "id": 17878, "name": "sk", "sort": [ { "key": "sort_order", "value": "5" } { …