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
0
votes
1 answer

holding old goose version while run test case in go lang

Firstly I created some migration and their goose version is 20220125506 something like that but afterwords I add some new migration files but my goose version does not change every time while running the test case. How do I change my goose version?…
0
votes
0 answers

GO application failed to connect to local PostgreSQL database got error cannot parse

GO application failed to connect to local PostgreSQL database using environment variables in Windows. After setting the environment variables using the windows command prompt like the following: set DATABASE_HOST=localhost set…
0
votes
1 answer

Golang curve25519 pubkey generator

I'm trying to implement the curve25519 algo for pubkey generation. But I got stuck on how to generate pubkey from sha256 encoded string in Go? I have no problems with generation pubkey from sha256 encoded string via Python: import hashlib import…
0
votes
1 answer

eko gocache for redis :: store.RedisStore does not implement store.StoreInterface

I am using this library https://github.com/eko/gocache for redis with go lang My code is package main import ( "context" "fmt" "time" "github.com/eko/gocache/cache" "github.com/eko/gocache/store" "github.com/go-redis/redis/v8" ) func main() { ctx…
chetanspeed511987
  • 1,995
  • 2
  • 22
  • 34
0
votes
1 answer

How to avoid duplicate row while gorm AutoMigrate

I want to insert to database from CSV file using gorm AutoMigrate and while inserting I want to avoid duplicate entry. How Can I achieve this? Please check the attached code. type User struct { gorm.Model ID int64 …
Benk I
  • 185
  • 13
0
votes
2 answers

Golang gorm join 2nd table data's now coming

Am new in Golang, Please assume I have 2 models like below type Jobs struct { JobID uint `json: "jobId" gorm:"primary_key;auto_increment"` SourcePath string `json: "sourcePath"` Priority int64…
Ramesh S
  • 585
  • 3
  • 10
  • 32
0
votes
1 answer

how to Extracting data from XML

I am working on extracting data from a xml output. I have written the below code. I just need to extract dept number from the below xml. On running the below code getting a null output. Can someone let me how to extract the dept number from the xml…
0
votes
1 answer

reading bool value using viper in Go

I'm using viper to manage the configurations and environment variables for a Go app . all of values are coming correct from the json config file expect the bool values are always coming false even it have a true value within the json file { …
Marco
  • 842
  • 6
  • 18
  • 42
0
votes
1 answer

Golang Using Type Struct List

I wanna using my Struct like List but IDE cannot give a chance for using. I know, have a syntax problem but I cannot find true syntax. I don't where is my mistake in code. What is the correct syntax when using Struct List ? package main import ( …
SabuhiGurbani
  • 91
  • 1
  • 6
0
votes
0 answers

elastic: Error 500 (Internal Server Error): all shards failed [type=search_phase_execution_exception] when searching frequently through golang

I'm using golang to write a tool which can search the relating information about a list of userIds respectively. The program stopped with "elastic: Error 500 (Internal Server Error): all shards failed [type=search_phase_execution_exception] " for…
Giotto
  • 19
  • 2
0
votes
1 answer

Retract Go functionality - retract older package versions as insecure, incompatible, or broken

I have a problem with one of my project release, where we did a release 1.0, but it was a mistake that we later analysed and our actual stable release is 0.7 and in future also we will be doing minor changes, so we want to refrain our user to use…
s_k_t
  • 689
  • 1
  • 15
  • 36
0
votes
1 answer

Can't read migration file using golang-migrate

After running the up command, my database doesn't seem to be recognizing the SQL contained inside relative/path/000001_init_schema.up.sql. So far: Verified I have a connection to the database Successfully executed the SQL inside my database manager…
Connor
  • 11
  • 1
  • 4
0
votes
1 answer

Didn't get Delete User records based on ID

I'm using Go with Gorm many2many association from User and Role tables. type User struct { //gorm.Model ID int64 `json:"id" gorm:"primary_key"` Active sql.NullString ` json:"active " ` Email …
0
votes
1 answer

How to send emails via cron job usng Golang MySQL?

Hope you all doing well. how can i using cron job and cron tab(by golang connection my sql) or anothor way using bash script excute (file golang) how can i do that. in crontab -e : set the code 31 17 * * * cd…
CXR
  • 33
  • 4
0
votes
1 answer

Functional parameters in Go functions

Is there a way to pass a function(which can be generic) to another function? I know that with known input types and return types we can pass a function but a generic approach is needed