Ignore unexported field

This commit is contained in:
Jinzhu 2013-11-04 07:58:40 +08:00
parent 0c4e43cd7a
commit 215b736fe1
1 changed files with 2 additions and 2 deletions

View File

@ -3,10 +3,10 @@ package gorm
import (
"errors"
"fmt"
"go/ast"
"reflect"
"regexp"
"strconv"
"time"
)
@ -82,7 +82,7 @@ func (m *Model) fields(operation string) (fields []Field) {
for i := 0; i < typ.NumField(); i++ {
p := typ.Field(i)
if !p.Anonymous {
if !p.Anonymous && ast.IsExported(p.Name) {
var field Field
field.Name = p.Name
field.DbName = toSnake(p.Name)