what is the default size of the gorm library for golang? what is the default size of string? Is it 255? http: gorm.io zh_CN docs mod. type:varchar(100)type:varchar(255) ...
what is the difference between unique_index and unique in the red box of ORM framework gorm, in go language? ...
the codes of a.go, b.go and a.go in the same level directory under 1.windows are as follows: package main import ( "fmt" "os" ) func main() { fi, err := os.Stat("b.go") if err != nil { fmt.Println...
how do Goland align identifiers when writing structures? Something like this: does have shortcut keys? Or can I just press the space manually? ...
MySQL table with the following structure CREATE TABLE `t_article` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `content` varchar(255) NOT NULL COMMENT , `like_count` int(10) unsigned NOT NULL DEFAULT 0 COMMENT , PRIMARY KEY (...
problem description the table is as follows < table id= "coinmarket " > < thead > < tr > < th > ranking < th > < th > currency < th > < th > currency name < th > < th > Price (USD) < th > < th > Market capitalization (USD) < th > < th > ...
golang s gorm defines a field to save the picture list question: type Article struct { BaseModel Title string `json:"title" gorm:"type:varchar(64);not null"` Content string `json:"content" g...
use golang to develop the gin framework for backend api,. Now every time you finish writing an interface, you need to run go build xxx to perform a compilation, then execute the compiled binary file, and then debug the interface. There is a problem in...
gorm creates records. What s the difference between NewRecord and Create? The code is as follows: user := User{Name: "Jinzhu", Age: 18, Birthday: time.Now()} db.NewRecord(user) => `true` db.Create(&user) db.NewRecord(user) =>...
gin framework of go language + mysql to do web development, the association between models, here is an example: package model import "time" Article type Article struct { ID uint `gorm:"primary_key" json:&q...
package main import ( "database sql driver" "fmt" "time" ) type JSONTime struct { time.Time } MarshalJSON on JSONTime format Time field with %Y-%m-%d %H:%M:%S func (t JSONTime) MarshalJSON() ([]byte, er...
I read the mysql information from the configuration file. How do mysql hosts, users, passwords, and database names be passed to sql.open () as variables? cfg, err := ini.Load("setting.ini") cfg.BlockMode = false if err != nil { panic(er...
problem description os.Getenv ( "GOPATH ") cannot be obtained, but os.Getenv ( "HOME ") can get normally. the environmental background of the problems and what methods you have tried in the terminal, ech $GOPATH output normally, GOPATH variable is...
When go returns a json string, is it true that only fields with uppercase or all uppercase letters in the structure will be returned? type User struct { Id int Name string sex string } me := User{Id: 12, Name: &quo...
I use cloudboot to install the system automatically, and the injected information is correct. I can also restart and start the installation automatically, but I always report an error, such as an error in the code. I don t understand it and solve the p...
package main func test() { arr := []string{ "1","2","3", } inter := ArrayToInterface(arr) inter? } func ArrayToInterface(t interface{}) interface{} { ...
SQL I want to implement select * from movies left join server on movies.server_id = server.id here is my go code. I don t know what the problem is. The data of the queried server field is not correct . type Server struct { Id int64 `gor...
``` func isNumber(n int) bool { var i, j, k int i = n % 10 j = (n 10) % 10 k = (n 100) % 10 sum := i*i*i + j*j*j + k*k*k return sum == n } ```...
the environment I use is go version go1.11.1 windows amd64 xorm + Sqlite3 I am using type User struct { Id int `json:"id" xorm:"pk autoincr unique(UNIQUE) INT(10) notnull"` Name string `json:"name" xorm...
In golang, os.exit () runtime.Goexit () return what s the difference? ...
such as the title. document here: http: doc.workerman.net appe... what is the use of this agreement? Is used to test telnet? ...
so now it is whether webpack can be used and how to complete the installation and normal use of webpack! Please give us your advice. ...
I would like to ask if there is any way to turn asynchronism into Synchronize, similar to ajax in jquery ; similar to this function getData(){ var dataList; $.ajax({ async:false, .... success:function(data){ ...
sendfile and mmap are both typical zero-copy technologies, and sendfile is very efficient when files do not need to be modified. It is said that mmap is more suitable for the transfer of small files, while sendfile is more suitable for large files. How s...
for example, the effect of Jiangsu bulge ...