Próbuję nadać uuid do pola UID
Error message
Importuje"github.com/satori/go.uuid"
Kod:
type Client struct {
UID string `gorm:"type:uuid;primary_key;default:uuid_generate_v4()"`
Name string
}
func (u *Client) BeforeCreate(tx *gorm.DB) (err error) {
u.UID = uuid.New()
return
}
"New not declared by package uuid". Wie ktoś jak to poprawnie zrobić?
`` is not officially supported, running under compatibility mode.
2021/03/31 16:27:08 sql: unknown driver "" (forgotten import?)
exit status 1
import (
"encoding/json"
"fmt"
"log"
"net/http"
"os"
"github.com/gorilla/mux"
"github.com/jinzhu/gorm"
_ "github.com/jinzhu/gorm/dialects/postgres"
uuid "github.com/satori/go.uuid"
)