go-gorm

    1热度

    1回答

    我想是这样的: type User struct { ID int `sql:"default:<myfunction>"` } 这可能与GORM?

    0热度

    1回答

    如何定义我的struct以在Go中为Gorm指定多列唯一索引? 如: type Something struct { gorm.Model First string `sql:"unique_index:unique_index_with_second"` Second string `sql:"unique_index:unique_index_with_first

    1热度

    1回答

    我有两个表 type Podcast struct { Id int Title string RssUrl string `sql:"unique_index"` Episodes []Episode } type Episode struct { Id int PodcastID int Title strin

    7热度

    2回答

    这是我的DB模式: 用户: id uuid PRIMARY KEY , title character "1234" "ABCD" 语言: id uuid PRIMARY KEY , name character "1122" "eng" "1133" "man" user_languages: user_id uuid, language_id uuid

    0热度

    1回答

    我想在gorm中使用多对多的关系。但是,该示例是一个部分片段,我尝试创建一个类似的示例代码片断失败。 package main import ( "github.com/jinzhu/gorm" _ "github.com/mattn/go-sqlite3" ) type Part struct { gorm.Model Name string

    1热度

    1回答

    我有以下表格。 nyct2010 和 旅行 我已经定义的模型如下。 type Nyct2010 struct { Id int `gorm:"column:gid"` Borocode int } type Trip struct { Id int PickupLongitude float64 `gorm:"column:pickup_lon

    0热度

    1回答

    我在我的项目中使用GORM,我想创建类似DB管理页面的东西。 要加载记录我发送使用参数GET: category: "name", // database table name 在服务器上我有下面的代码: func LoadItems(db *gorm.DB, category string) interface{} { var items interface{} loa

    1热度

    1回答

    我正在使用GORM访问我的数据库中的记录。现在我想检索所有未删除的记录,这意味着属性DeletedAt必须为NULL。 我尝试了以下命令链与WHERE(),但他们没有返回任何结果。 users := []*models.User{} db.Where("deleted_at", nil).Find(&users) 和 db.Where("deleted_at", "NULL").Find(&

    0热度

    1回答

    为什么gorm忽略sql:"index"标签?没有索引创建。 这里使用的数据库是PostgreSQL(导入_ "github.com/lib/pq")。这Model结构被使用(因为默认gorm.Model使用自动增量号 - serial - 作为主键,我想成立id自己): type Model struct { ID int64 `sql:"type:bigint PRIMARY KE

    1热度

    1回答

    语境: https://github.com/fusspawn/tserver/blob/master/app/controllers/gorp.go 由于试图让格姆设置部分我试图标准随缘/ GORP例子转换。 但是,即使定义了Begin(),Commit(),Rollback()方法也足以导致恐慌。 TRACE 2015/09/06 17:37:47 harness.go:126: Rebuil