-
-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
Error: error render template got error: failed to format generated code for g/user_info.go, got error g/user_info.go:29:46: expected ';', found ']' (and 1 more errors)
Usage:
gorm gen [flags]
Flags:
-h, --help help for gen
-i, --input string Path to Go interface file with raw SQL annotations
-o, --output string Directory to place generated code (default "./g")
-t, --typed Generated Typed API (default true)
error render template got error: failed to format generated code for g/user_info.go, got error g/user_info.go:29:46: expected ';', found ']' (and 1 more errors)
type UserInfo struct {
UserId string `gorm:"column:user_id;not null;primaryKey;type:uuid;autoIncrement:false;comment:用户id"`
Labels kk_pg.StringArray `gorm:"column:labels;type:text[];comment:标签"`
Introduction string `gorm:"column:introduction;type:text;default:'';not null;comment:简介" `
Avatar string `gorm:"column:avatar;type:text;default:'';not null;comment:头像"`
Height float32 `gorm:"column:height;type:numeric(5,2);default:0.0;not null;index;comment:身高"`
Weight float32 `gorm:"column:weight;type:numeric(5,2);default:0.0;not null;index;comment:体重"`
Photos datatypes.JSONSlice[kk_models.ResourceOrder] `gorm:"column:photos;type:jsonb;comment:个人照片"`
PinMoments datatypes.JSONSlice[kk_models.ResourceOrder] `gorm:"column:pin_moments;type:jsonb;comment:置顶动态"`
Birthday time.Time `gorm:"column:birthday;type:date;not null;index;comment:生日"`
Gender PBUserInfo_UserInfoGender `gorm:"column:gender;type:smallint;default:0;not null;index;comment:性别 0 女 1 男"`
Nickname string `gorm:"column:nickname;type:text;default:'';not null;comment:昵称"`
}gen code
// Code generated by 'gorm.io/cli/gorm'. DO NOT EDIT.
package g
import (
"gorm.io/gorm"
"gorm.io/gorm/clause"
"gorm.io/cli/gorm/field"
"gorm.io/cli/gorm/typed"
"ss_go/service_base/models/orm"
"time"
"gitee.com/cruvie/kk_go_kit/kk_models"
"ss_go/env_prepare/pg_table_hub"
"gitee.com/cruvie/kk_go_kit/kk_pg"
"google.golang.org/protobuf/types/known/timestamppb"
"gorm.io/datatypes"
)
var UserInfo = struct {
UserId field.String
Labels field.Field[kk_pg.StringArray]
Introduction field.String
Avatar field.String
Height field.Number[float32]
Weight field.Number[float32]
Photos field.Struct[kk_models.ResourceOrder]]
PinMoments field.Struct[kk_models.ResourceOrder]] // wrong
Birthday field.Time
Gender field.Struct[orm.PBUserInfo_UserInfoGender]
Nickname field.String
}{
UserId: field.String{}.WithColumn("user_id"),
Labels: field.Field[kk_pg.StringArray]{}.WithColumn("labels"),
Introduction: field.String{}.WithColumn("introduction"),
Avatar: field.String{}.WithColumn("avatar"),
Height: field.Number[float32]{}.WithColumn("height"),
Weight: field.Number[float32]{}.WithColumn("weight"),
Photos: field.Struct[kk_models.ResourceOrder]]{}.WithName("Photos"),
PinMoments: field.Struct[kk_models.ResourceOrder]]{}.WithName("PinMoments"),
Birthday: field.Time{}.WithColumn("birthday"),
Gender: field.Struct[orm.PBUserInfo_UserInfoGender]{}.WithName("Gender"),
Nickname: field.String{}.WithColumn("nickname"),
}
Metadata
Metadata
Assignees
Labels
No labels