gorm tag

7 questions


1 answers
75 views
0
I want to select with gorm and return a specific value of json.

import( github.com/jinzhu/gorm _github.com/mattn/go-sqlite3)typeUnivNormalTimeTable structure { Id int`json: id` Hour int `json: hour` Minute int`json: minute` DayOfTheWeek string `json: day_of_the_we...

2 years ago

1 answers
114 views
0
Understanding When a Structure Has a Slice

I would like to save the following structures in the form of multiple teachers in one LectureInfo.typeLectureInfoct{ gorm.Model Name string Teachers[] Teacher `gorm: foreignKey:LectureID`}typeTeacher ...

2 years ago

1 answers
66 views
0
Table name when preloading in gorm

db.Preload(Orders).Preload(Profile).Preload(Role).Find(&users)//// SELECT* FROM users;//// SELECT* FROM orders WHERE user_id IN (1, 2, 3, 4); // has many//// SELECT* FROM profiles WHERE user_id IN...

2 years ago

1 answers
126 views
0
Ambiguous search LIKE statements do not hit

I used the postgreSQL LIKE statement in the ORM called gorm in the Go language, but somehow I can't get the data.The model is assumed to be: type Model structure { ID int Name string Phonetic string...

2 years ago

1 answers
115 views
0
Only certain table JOIN errors in PostgreSQL

Only certain table JOINs fail in PostgreSQLWe are developing API servers in Go language and PostgreSQL.At that time, the following error occurs only when the user table is used as JOIN.Starting from t...

2 years ago

2 answers
95 views
0
DB contents are retrieved using Find in GORM, but all are empty

I am currently making a simple API using GAE+CloudSQL.We tried to implement an API that could retrieve all DB data and created the following code:package mainimport( encoding/json fmt _github.com/go-s...

2 years ago

1 answers
84 views
0
I want to put multiple unique constraints on a single column in Gorm

I'd like to place multiple unique constraints on a single column in Gorm.typeObject structure{ Z string `gorm: unique_index:unique_a;unique_index:unique_b` A string `gorm: unique_index:unique_a` B str...

2 years ago

© 2024 OneMinuteCode. All rights reserved.