casbin / gorm-adapter

GORM adapter for Casbin, see extended version of GORM Adapter Ex at: https://github.com/casbin/gorm-adapter-ex
https://github.com/casbin/casbin
Apache License 2.0
692 stars 207 forks source link

[bug]unknown field 'PType' in struct literal of type struct #156

Closed hktalent closed 2 years ago

hktalent commented 2 years ago

why? v3@v3.5.0 go build my project

# github.com/hktalent/gin-vue-admin/server/source/system
source/system/casbin.go:21:4: unknown field 'PType' in struct literal of type struct{ID uint "gorm:\"primaryKey;autoIncrement\""; Ptype string "gorm:\"size:100\""; V0 string "gorm:\"size:100\""; V1 string "gorm:\"size:100\""; V2 string "gorm:\"size:100\""; V3 string "gorm:\"size:100\""; V4 string "gorm:\"size:100\""; V5 string "gorm:\"size:100\""}
source/system/casbin.go:22:4: unknown field 'PType' in struct literal of type struct{ID uint "gorm:\"primaryKey;autoIncrement\""; Ptype string "gorm:\"size:100\""; V0 string "gorm:\"size:100\""; V1 string "gorm:\"size:100\""; V2 string "gorm:\"size:100\""; V3 string "gorm:\"size:100\""; V4 string "gorm:\"size:100\""; V5 string "gorm:\"size:100\""}
source/system/casbin.go:24:4: unknown field 'PType' in struct literal of type struct{ID uint "gorm:\"primaryKey;autoIncrement\""; Ptype string "gorm:\"size:100\""; V0 string "gorm:\"size:100\""; V1 string "gorm:\"size:100\""; V2 string "gorm:\"size:100\""; V3 string "gorm:\"size:100\""; V4 string "gorm:\"size:100\""; V5 string "gorm:\"size:100\""}
source/system/casbin.go:25:4: unknown field 'PType' in struct literal of type struct{ID uint "gorm:\"primaryKey;autoIncrement\""; Ptype string "gorm:\"size:100\""; V0 string "gorm:\"size:100\""; V1 string "gorm:\"size:100\""; V2 string "gorm:\"size:100\""; V3 string "gorm:\"size:100\""; V4 string "gorm:\"size:100\""; V5 string "gorm:\"size:100\""}
source/system/casbin.go:26:4: unknown field 'PType' in struct literal of type struct{ID uint "gorm:\"primaryKey;autoIncrement\""; Ptype string "gorm:\"size:100\""; V0 string "gorm:\"size:100\""; V1 string "gorm:\"size:100\""; V2 string "gorm:\"size:100\""; V3 string "gorm:\"size:100\""; V4 string "gorm:\"size:100\""; V5 string "gorm:\"size:100\""}
source/system/casbin.go:27:4: unknown field 'PType' in struct literal of type struct{ID uint "gorm:\"primaryKey;autoIncrement\""; Ptype string "gorm:\"size:100\""; V0 string "gorm:\"size:100\""; V1 string "gorm:\"size:100\""; V2 string "gorm:\"size:100\""; V3 string "gorm:\"size:100\""; V4 string "gorm:\"size:100\""; V5 string "gorm:\"size:100\""}
source/system/casbin.go:28:4: unknown field 'PType' in struct literal of type struct{ID uint "gorm:\"primaryKey;autoIncrement\""; Ptype string "gorm:\"size:100\""; V0 string "gorm:\"size:100\""; V1 string "gorm:\"size:100\""; V2 string "gorm:\"size:100\""; V3 string "gorm:\"size:100\""; V4 string "gorm:\"size:100\""; V5 string "gorm:\"size:100\""}
source/system/casbin.go:29:4: unknown field 'PType' in struct literal of type struct{ID uint "gorm:\"primaryKey;autoIncrement\""; Ptype string "gorm:\"size:100\""; V0 string "gorm:\"size:100\""; V1 string "gorm:\"size:100\""; V2 string "gorm:\"size:100\""; V3 string "gorm:\"size:100\""; V4 string "gorm:\"size:100\""; V5 string "gorm:\"size:100\""}
source/system/casbin.go:30:4: unknown field 'PType' in struct literal of type struct{ID uint "gorm:\"primaryKey;autoIncrement\""; Ptype string "gorm:\"size:100\""; V0 string "gorm:\"size:100\""; V1 string "gorm:\"size:100\""; V2 string "gorm:\"size:100\""; V3 string "gorm:\"size:100\""; V4 string "gorm:\"size:100\""; V5 string "gorm:\"size:100\""}
source/system/casbin.go:32:4: unknown field 'PType' in struct literal of type struct{ID uint "gorm:\"primaryKey;autoIncrement\""; Ptype string "gorm:\"size:100\""; V0 string "gorm:\"size:100\""; V1 string "gorm:\"size:100\""; V2 string "gorm:\"size:100\""; V3 string "gorm:\"size:100\""; V4 string "gorm:\"size:100\""; V5 string "gorm:\"size:100\""}
source/system/casbin.go:32:4: too many errors
casbin-bot commented 2 years ago

@tangyang9464 @closetool @sagilio

hktalent commented 2 years ago

@tangyang9464 @closetool @sagilio v3.0.2 is ok

hsluoyz commented 2 years ago

@hktalent PType has been renamed to Ptype starting from v3.2.7: https://github.com/casbin/gorm-adapter/commit/fa4239f79114122142bce7dfe60c09f8eef5c741 . Please modify your DB column name to use the latest version