From d5a8d74114b1f8fad08d06f4115130c84d971e20 Mon Sep 17 00:00:00 2001 From: Arvin Foroutan Date: Mon, 25 Jul 2016 21:07:13 -0700 Subject: [PATCH] Allow a struct to be used as a field with jsonb --- session.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/session.go b/session.go index 35e7a306..d65a0d7d 100644 --- a/session.go +++ b/session.go @@ -3042,7 +3042,9 @@ func (session *Session) value2Interface(col *core.Column, fieldValue reflect.Val pkField := reflect.Indirect(fieldValue).FieldByName(fieldTable.PKColumns()[0].FieldName) return pkField.Interface(), nil } - return 0, fmt.Errorf("no primary key for col %v", col.Name) + if fieldTable.Type == nil { + return 0, fmt.Errorf("no primary key for col %v", col.Name) + } } if col.SQLType.IsText() {