mirror of https://github.com/go-gorm/gorm.git
Ignore unexported field
This commit is contained in:
parent
0c4e43cd7a
commit
215b736fe1
4
model.go
4
model.go
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue